// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by google-apis-code-generator 1.5.1
//     C# generator version: 1.22.0
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

/**
 * \brief
 *   Gmail API Version v1
 *
 * \section ApiInfo API Version Information
 *    <table>
 *      <tr><th>API
 *          <td><a href='https://developers.google.com/gmail/api/'>Gmail API</a>
 *      <tr><th>API Version<td>v1
 *      <tr><th>API Rev<td>20170222 (783)
 *      <tr><th>API Docs
 *          <td><a href='https://developers.google.com/gmail/api/'>
 *              https://developers.google.com/gmail/api/</a>
 *      <tr><th>Discovery Name<td>gmail
 *    </table>
 *
 * \section ForMoreInfo For More Information
 *
 * The complete API documentation for using Gmail API can be found at
 * <a href='https://developers.google.com/gmail/api/'>https://developers.google.com/gmail/api/</a>.
 *
 * For more information about the Google APIs Client Library for .NET, see
 * <a href='https://developers.google.com/api-client-library/dotnet/get_started'>
 * https://developers.google.com/api-client-library/dotnet/get_started</a>
 */

namespace Google.Apis.Gmail.v1
{
    /// <summary>The Gmail Service.</summary>
    public class GmailService : Google.Apis.Services.BaseClientService
    {
        /// <summary>The API version.</summary>
        public const string Version = "v1";

        /// <summary>The discovery version used to generate this service.</summary>
        public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed =
            Google.Apis.Discovery.DiscoveryVersion.Version_1_0;

        /// <summary>Constructs a new service.</summary>
        public GmailService() :
            this(new Google.Apis.Services.BaseClientService.Initializer()) {}

        /// <summary>Constructs a new service.</summary>
        /// <param name="initializer">The service initializer.</param>
        public GmailService(Google.Apis.Services.BaseClientService.Initializer initializer)
            : base(initializer)
        {
            users = new UsersResource(this);
        }

        /// <summary>Gets the service supported features.</summary>
        public override System.Collections.Generic.IList<string> Features
        {
            get { return new string[0]; }
        }

        /// <summary>Gets the service name.</summary>
        public override string Name
        {
            get { return "gmail"; }
        }

        /// <summary>Gets the service base URI.</summary>
        public override string BaseUri
        {
            get { return "https://www.googleapis.com/gmail/v1/users/"; }
        }

        /// <summary>Gets the service base path.</summary>
        public override string BasePath
        {
            get { return "gmail/v1/users/"; }
        }

        /// <summary>Available OAuth 2.0 scopes for use with the Gmail API.</summary>
        public class Scope
        {
            /// <summary>Read, send, delete, and manage your email</summary>
            public static string MailGoogleCom = "https://mail.google.com/";

            /// <summary>Manage drafts and send emails</summary>
            public static string GmailCompose = "https://www.googleapis.com/auth/gmail.compose";

            /// <summary>Insert mail into your mailbox</summary>
            public static string GmailInsert = "https://www.googleapis.com/auth/gmail.insert";

            /// <summary>Manage mailbox labels</summary>
            public static string GmailLabels = "https://www.googleapis.com/auth/gmail.labels";

            /// <summary>View your email message metadata such as labels and headers, but not the email body</summary>
            public static string GmailMetadata = "https://www.googleapis.com/auth/gmail.metadata";

            /// <summary>View and modify but not delete your email</summary>
            public static string GmailModify = "https://www.googleapis.com/auth/gmail.modify";

            /// <summary>View your emails messages and settings</summary>
            public static string GmailReadonly = "https://www.googleapis.com/auth/gmail.readonly";

            /// <summary>Send email on your behalf</summary>
            public static string GmailSend = "https://www.googleapis.com/auth/gmail.send";

            /// <summary>Manage your basic mail settings</summary>
            public static string GmailSettingsBasic = "https://www.googleapis.com/auth/gmail.settings.basic";

            /// <summary>Manage your sensitive mail settings, including who can manage your mail</summary>
            public static string GmailSettingsSharing = "https://www.googleapis.com/auth/gmail.settings.sharing";

        }



        private readonly UsersResource users;

        /// <summary>Gets the Users resource.</summary>
        public virtual UsersResource Users
        {
            get { return users; }
        }
    }

    ///<summary>A base abstract class for Gmail requests.</summary>
    public abstract class GmailBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse>
    {
        ///<summary>Constructs a new GmailBaseServiceRequest instance.</summary>
        protected GmailBaseServiceRequest(Google.Apis.Services.IClientService service)
            : base(service)
        {
        }

        /// <summary>Data format for the response.</summary>
        /// [default: json]
        [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<AltEnum> Alt { get; set; }

        /// <summary>Data format for the response.</summary>
        public enum AltEnum
        {
            /// <summary>Responses with Content-Type of application/json</summary>
            [Google.Apis.Util.StringValueAttribute("json")]
            Json,
        }

        /// <summary>Selector specifying which fields to include in a partial response.</summary>
        [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string Fields { get; set; }

        /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and reports.
        /// Required unless you provide an OAuth 2.0 token.</summary>
        [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string Key { get; set; }

        /// <summary>OAuth 2.0 token for the current user.</summary>
        [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string OauthToken { get; set; }

        /// <summary>Returns response with indentations and line breaks.</summary>
        /// [default: true]
        [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
        public virtual System.Nullable<bool> PrettyPrint { get; set; }

        /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary string
        /// assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.</summary>
        [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string QuotaUser { get; set; }

        /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-user
        /// limits.</summary>
        [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
        public virtual string UserIp { get; set; }

        /// <summary>Initializes Gmail parameter list.</summary>
        protected override void InitParameters()
        {
            base.InitParameters();

            RequestParameters.Add(
                "alt", new Google.Apis.Discovery.Parameter
                {
                    Name = "alt",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = "json",
                    Pattern = null,
                });
            RequestParameters.Add(
                "fields", new Google.Apis.Discovery.Parameter
                {
                    Name = "fields",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "key", new Google.Apis.Discovery.Parameter
                {
                    Name = "key",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "oauth_token", new Google.Apis.Discovery.Parameter
                {
                    Name = "oauth_token",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "prettyPrint", new Google.Apis.Discovery.Parameter
                {
                    Name = "prettyPrint",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = "true",
                    Pattern = null,
                });
            RequestParameters.Add(
                "quotaUser", new Google.Apis.Discovery.Parameter
                {
                    Name = "quotaUser",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
            RequestParameters.Add(
                "userIp", new Google.Apis.Discovery.Parameter
                {
                    Name = "userIp",
                    IsRequired = false,
                    ParameterType = "query",
                    DefaultValue = null,
                    Pattern = null,
                });
        }
    }

    /// <summary>The "users" collection of methods.</summary>
    public class UsersResource
    {
        private const string Resource = "users";

        /// <summary>The service which this resource belongs to.</summary>
        private readonly Google.Apis.Services.IClientService service;

        /// <summary>Constructs a new resource.</summary>
        public UsersResource(Google.Apis.Services.IClientService service)
        {
            this.service = service;
            drafts = new DraftsResource(service);
            history = new HistoryResource(service);
            labels = new LabelsResource(service);
            messages = new MessagesResource(service);
            settings = new SettingsResource(service);
            threads = new ThreadsResource(service);

        }

        private readonly DraftsResource drafts;

        /// <summary>Gets the Drafts resource.</summary>
        public virtual DraftsResource Drafts
        {
            get { return drafts; }
        }

        /// <summary>The "drafts" collection of methods.</summary>
        public class DraftsResource
        {
            private const string Resource = "drafts";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public DraftsResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;

            }


            /// <summary>Creates a new draft with the DRAFT label.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual CreateRequest Create(Google.Apis.Gmail.v1.Data.Draft body, string userId)
            {
                return new CreateRequest(service, body, userId);
            }

            /// <summary>Creates a new draft with the DRAFT label.</summary>
            public class CreateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Draft>
            {
                /// <summary>Constructs a new Create request.</summary>
                public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Draft Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "create"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts"; }
                }

                /// <summary>Initializes Create parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Creates a new draft with the DRAFT label.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual CreateMediaUpload Create(Google.Apis.Gmail.v1.Data.Draft body, string userId, System.IO.Stream stream, string contentType)
            {
                return new CreateMediaUpload(service, body, userId, stream, contentType);
            }

            /// <summary>Create media upload which supports resumable upload.</summary>
            public class CreateMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Draft, Google.Apis.Gmail.v1.Data.Draft>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Constructs a new Create media upload instance.</summary>
                public CreateMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string
                 userId, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/drafts"), "POST", stream, contentType)
                {
                    UserId = userId;
                    Body = body;
                }
            }

            /// <summary>Immediately and permanently deletes the specified draft. Does not simply trash it.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the draft to delete.</param>
            public virtual DeleteRequest Delete(string userId, string id)
            {
                return new DeleteRequest(service, userId, id);
            }

            /// <summary>Immediately and permanently deletes the specified draft. Does not simply trash it.</summary>
            public class DeleteRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new Delete request.</summary>
                public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the draft to delete.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "delete"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "DELETE"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts/{id}"; }
                }

                /// <summary>Initializes Delete parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets the specified draft.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the draft to retrieve.</param>
            public virtual GetRequest Get(string userId, string id)
            {
                return new GetRequest(service, userId, id);
            }

            /// <summary>Gets the specified draft.</summary>
            public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Draft>
            {
                /// <summary>Constructs a new Get request.</summary>
                public GetRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the draft to retrieve.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }

                /// <summary>The format to return the draft in.</summary>
                /// [default: full]
                [Google.Apis.Util.RequestParameterAttribute("format", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<FormatEnum> Format { get; set; }

                /// <summary>The format to return the draft in.</summary>
                public enum FormatEnum
                {
                    [Google.Apis.Util.StringValueAttribute("full")]
                    Full,
                    [Google.Apis.Util.StringValueAttribute("metadata")]
                    Metadata,
                    [Google.Apis.Util.StringValueAttribute("minimal")]
                    Minimal,
                    [Google.Apis.Util.StringValueAttribute("raw")]
                    Raw,
                }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "get"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts/{id}"; }
                }

                /// <summary>Initializes Get parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "format", new Google.Apis.Discovery.Parameter
                        {
                            Name = "format",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "full",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Lists the drafts in the user's mailbox.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ListRequest List(string userId)
            {
                return new ListRequest(service, userId);
            }

            /// <summary>Lists the drafts in the user's mailbox.</summary>
            public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListDraftsResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Include drafts from SPAM and TRASH in the results.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("includeSpamTrash", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> IncludeSpamTrash { get; set; }

                /// <summary>Maximum number of drafts to return.</summary>
                /// [default: 100]
                [Google.Apis.Util.RequestParameterAttribute("maxResults", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<long> MaxResults { get; set; }

                /// <summary>Page token to retrieve a specific page of results in the list.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string PageToken { get; set; }

                /// <summary>Only return draft messages matching the specified query. Supports the same query format as
                /// the Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread".</summary>
                [Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Q { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "includeSpamTrash", new Google.Apis.Discovery.Parameter
                        {
                            Name = "includeSpamTrash",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "maxResults", new Google.Apis.Discovery.Parameter
                        {
                            Name = "maxResults",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "100",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "pageToken", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageToken",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "q", new Google.Apis.Discovery.Parameter
                        {
                            Name = "q",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual SendRequest Send(Google.Apis.Gmail.v1.Data.Draft body, string userId)
            {
                return new SendRequest(service, body, userId);
            }

            /// <summary>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.</summary>
            public class SendRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Send request.</summary>
                public SendRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Draft Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "send"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts/send"; }
                }

                /// <summary>Initializes Send parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual SendMediaUpload Send(Google.Apis.Gmail.v1.Data.Draft body, string userId, System.IO.Stream stream, string contentType)
            {
                return new SendMediaUpload(service, body, userId, stream, contentType);
            }

            /// <summary>Send media upload which supports resumable upload.</summary>
            public class SendMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Draft, Google.Apis.Gmail.v1.Data.Message>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Constructs a new Send media upload instance.</summary>
                public SendMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string
                 userId, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/drafts/send"), "POST", stream, contentType)
                {
                    UserId = userId;
                    Body = body;
                }
            }

            /// <summary>Replaces a draft's content.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the draft to update.</param>
            public virtual UpdateRequest Update(Google.Apis.Gmail.v1.Data.Draft body, string userId, string id)
            {
                return new UpdateRequest(service, body, userId, id);
            }

            /// <summary>Replaces a draft's content.</summary>
            public class UpdateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Draft>
            {
                /// <summary>Constructs a new Update request.</summary>
                public UpdateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the draft to update.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Draft Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "update"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/drafts/{id}"; }
                }

                /// <summary>Initializes Update parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Replaces a draft's content.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the draft to update.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual UpdateMediaUpload Update(Google.Apis.Gmail.v1.Data.Draft body, string userId, string id, System.IO.Stream stream, string contentType)
            {
                return new UpdateMediaUpload(service, body, userId, id, stream, contentType);
            }

            /// <summary>Update media upload which supports resumable upload.</summary>
            public class UpdateMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Draft, Google.Apis.Gmail.v1.Data.Draft>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the draft to update.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }

                /// <summary>Constructs a new Update media upload instance.</summary>
                public UpdateMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Draft body, string
                 userId, string
                 id, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/drafts/{id}"), "PUT", stream, contentType)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                }
            }
        }
        private readonly HistoryResource history;

        /// <summary>Gets the History resource.</summary>
        public virtual HistoryResource History
        {
            get { return history; }
        }

        /// <summary>The "history" collection of methods.</summary>
        public class HistoryResource
        {
            private const string Resource = "history";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public HistoryResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;

            }


            /// <summary>Lists the history of all changes to the given mailbox. History results are returned in
            /// chronological order (increasing historyId).</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ListRequest List(string userId)
            {
                return new ListRequest(service, userId);
            }

            /// <summary>Lists the history of all changes to the given mailbox. History results are returned in
            /// chronological order (increasing historyId).</summary>
            public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListHistoryResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>History types to be returned by the function</summary>
                [Google.Apis.Util.RequestParameterAttribute("historyTypes", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<HistoryTypesEnum> HistoryTypes { get; set; }

                /// <summary>History types to be returned by the function</summary>
                public enum HistoryTypesEnum
                {
                    [Google.Apis.Util.StringValueAttribute("labelAdded")]
                    LabelAdded,
                    [Google.Apis.Util.StringValueAttribute("labelRemoved")]
                    LabelRemoved,
                    [Google.Apis.Util.StringValueAttribute("messageAdded")]
                    MessageAdded,
                    [Google.Apis.Util.StringValueAttribute("messageDeleted")]
                    MessageDeleted,
                }

                /// <summary>Only return messages with a label matching the ID.</summary>
                [Google.Apis.Util.RequestParameterAttribute("labelId", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string LabelId { get; set; }

                /// <summary>The maximum number of history records to return.</summary>
                /// [default: 100]
                [Google.Apis.Util.RequestParameterAttribute("maxResults", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<long> MaxResults { get; set; }

                /// <summary>Page token to retrieve a specific page of results in the list.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string PageToken { get; set; }

                /// <summary>Required. Returns history records after the specified startHistoryId. The supplied
                /// startHistoryId should be obtained from the historyId of a message, thread, or previous list
                /// response. History IDs increase chronologically but are not contiguous with random gaps in between
                /// valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error
                /// code. A historyId is typically valid for at least a week, but in some rare circumstances may be
                /// valid for only a few hours. If you receive an HTTP 404 error response, your application should
                /// perform a full sync. If you receive no nextPageToken in the response, there are no updates to
                /// retrieve and you can store the returned historyId for a future request.</summary>
                [Google.Apis.Util.RequestParameterAttribute("startHistoryId", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<ulong> StartHistoryId { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/history"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "historyTypes", new Google.Apis.Discovery.Parameter
                        {
                            Name = "historyTypes",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "labelId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "labelId",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "maxResults", new Google.Apis.Discovery.Parameter
                        {
                            Name = "maxResults",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "100",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "pageToken", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageToken",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "startHistoryId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "startHistoryId",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }
        }
        private readonly LabelsResource labels;

        /// <summary>Gets the Labels resource.</summary>
        public virtual LabelsResource Labels
        {
            get { return labels; }
        }

        /// <summary>The "labels" collection of methods.</summary>
        public class LabelsResource
        {
            private const string Resource = "labels";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public LabelsResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;

            }


            /// <summary>Creates a new label.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual CreateRequest Create(Google.Apis.Gmail.v1.Data.Label body, string userId)
            {
                return new CreateRequest(service, body, userId);
            }

            /// <summary>Creates a new label.</summary>
            public class CreateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Label>
            {
                /// <summary>Constructs a new Create request.</summary>
                public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Label body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Label Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "create"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels"; }
                }

                /// <summary>Initializes Create parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Immediately and permanently deletes the specified label and removes it from any messages and
            /// threads that it is applied to.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the label to delete.</param>
            public virtual DeleteRequest Delete(string userId, string id)
            {
                return new DeleteRequest(service, userId, id);
            }

            /// <summary>Immediately and permanently deletes the specified label and removes it from any messages and
            /// threads that it is applied to.</summary>
            public class DeleteRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new Delete request.</summary>
                public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the label to delete.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "delete"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "DELETE"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels/{id}"; }
                }

                /// <summary>Initializes Delete parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets the specified label.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the label to retrieve.</param>
            public virtual GetRequest Get(string userId, string id)
            {
                return new GetRequest(service, userId, id);
            }

            /// <summary>Gets the specified label.</summary>
            public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Label>
            {
                /// <summary>Constructs a new Get request.</summary>
                public GetRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the label to retrieve.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "get"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels/{id}"; }
                }

                /// <summary>Initializes Get parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Lists all labels in the user's mailbox.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ListRequest List(string userId)
            {
                return new ListRequest(service, userId);
            }

            /// <summary>Lists all labels in the user's mailbox.</summary>
            public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListLabelsResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates the specified label. This method supports patch semantics.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the label to update.</param>
            public virtual PatchRequest Patch(Google.Apis.Gmail.v1.Data.Label body, string userId, string id)
            {
                return new PatchRequest(service, body, userId, id);
            }

            /// <summary>Updates the specified label. This method supports patch semantics.</summary>
            public class PatchRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Label>
            {
                /// <summary>Constructs a new Patch request.</summary>
                public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Label body, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the label to update.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Label Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "patch"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PATCH"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels/{id}"; }
                }

                /// <summary>Initializes Patch parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates the specified label.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the label to update.</param>
            public virtual UpdateRequest Update(Google.Apis.Gmail.v1.Data.Label body, string userId, string id)
            {
                return new UpdateRequest(service, body, userId, id);
            }

            /// <summary>Updates the specified label.</summary>
            public class UpdateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Label>
            {
                /// <summary>Constructs a new Update request.</summary>
                public UpdateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Label body, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the label to update.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Label Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "update"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/labels/{id}"; }
                }

                /// <summary>Initializes Update parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }
        }
        private readonly MessagesResource messages;

        /// <summary>Gets the Messages resource.</summary>
        public virtual MessagesResource Messages
        {
            get { return messages; }
        }

        /// <summary>The "messages" collection of methods.</summary>
        public class MessagesResource
        {
            private const string Resource = "messages";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public MessagesResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;
                attachments = new AttachmentsResource(service);

            }

            private readonly AttachmentsResource attachments;

            /// <summary>Gets the Attachments resource.</summary>
            public virtual AttachmentsResource Attachments
            {
                get { return attachments; }
            }

            /// <summary>The "attachments" collection of methods.</summary>
            public class AttachmentsResource
            {
                private const string Resource = "attachments";

                /// <summary>The service which this resource belongs to.</summary>
                private readonly Google.Apis.Services.IClientService service;

                /// <summary>Constructs a new resource.</summary>
                public AttachmentsResource(Google.Apis.Services.IClientService service)
                {
                    this.service = service;

                }


                /// <summary>Gets the specified message attachment.</summary>
                /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                /// user.</param>
                /// <param name="messageId">The ID of the message containing the attachment.</param>
                ///
                /// <param name="id">The ID of the attachment.</param>
                public virtual GetRequest Get(string userId, string messageId, string id)
                {
                    return new GetRequest(service, userId, messageId, id);
                }

                /// <summary>Gets the specified message attachment.</summary>
                public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.MessagePartBody>
                {
                    /// <summary>Constructs a new Get request.</summary>
                    public GetRequest(Google.Apis.Services.IClientService service, string userId, string messageId, string id)
                        : base(service)
                    {
                        UserId = userId;
                        MessageId = messageId;
                        Id = id;
                        InitParameters();
                    }


                    /// <summary>The user's email address. The special value me can be used to indicate the
                    /// authenticated user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The ID of the message containing the attachment.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("messageId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string MessageId { get; private set; }

                    /// <summary>The ID of the attachment.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string Id { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "get"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/messages/{messageId}/attachments/{id}"; }
                    }

                    /// <summary>Initializes Get parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "messageId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "messageId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "id", new Google.Apis.Discovery.Parameter
                            {
                                Name = "id",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }
            }

            /// <summary>Deletes many messages by message ID. Provides no guarantees that messages were not already
            /// deleted or even existed at all.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual BatchDeleteRequest BatchDelete(Google.Apis.Gmail.v1.Data.BatchDeleteMessagesRequest body, string userId)
            {
                return new BatchDeleteRequest(service, body, userId);
            }

            /// <summary>Deletes many messages by message ID. Provides no guarantees that messages were not already
            /// deleted or even existed at all.</summary>
            public class BatchDeleteRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new BatchDelete request.</summary>
                public BatchDeleteRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.BatchDeleteMessagesRequest body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.BatchDeleteMessagesRequest Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "batchDelete"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/batchDelete"; }
                }

                /// <summary>Initializes BatchDelete parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Modifies the labels on the specified messages.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual BatchModifyRequest BatchModify(Google.Apis.Gmail.v1.Data.BatchModifyMessagesRequest body, string userId)
            {
                return new BatchModifyRequest(service, body, userId);
            }

            /// <summary>Modifies the labels on the specified messages.</summary>
            public class BatchModifyRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new BatchModify request.</summary>
                public BatchModifyRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.BatchModifyMessagesRequest body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.BatchModifyMessagesRequest Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "batchModify"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/batchModify"; }
                }

                /// <summary>Initializes BatchModify parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Immediately and permanently deletes the specified message. This operation cannot be undone.
            /// Prefer messages.trash instead.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the message to delete.</param>
            public virtual DeleteRequest Delete(string userId, string id)
            {
                return new DeleteRequest(service, userId, id);
            }

            /// <summary>Immediately and permanently deletes the specified message. This operation cannot be undone.
            /// Prefer messages.trash instead.</summary>
            public class DeleteRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new Delete request.</summary>
                public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the message to delete.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "delete"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "DELETE"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/{id}"; }
                }

                /// <summary>Initializes Delete parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets the specified message.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the message to retrieve.</param>
            public virtual GetRequest Get(string userId, string id)
            {
                return new GetRequest(service, userId, id);
            }

            /// <summary>Gets the specified message.</summary>
            public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Get request.</summary>
                public GetRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the message to retrieve.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }

                /// <summary>The format to return the message in.</summary>
                /// [default: full]
                [Google.Apis.Util.RequestParameterAttribute("format", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<FormatEnum> Format { get; set; }

                /// <summary>The format to return the message in.</summary>
                public enum FormatEnum
                {
                    [Google.Apis.Util.StringValueAttribute("full")]
                    Full,
                    [Google.Apis.Util.StringValueAttribute("metadata")]
                    Metadata,
                    [Google.Apis.Util.StringValueAttribute("minimal")]
                    Minimal,
                    [Google.Apis.Util.StringValueAttribute("raw")]
                    Raw,
                }

                /// <summary>When given and format is METADATA, only include headers specified.</summary>
                [Google.Apis.Util.RequestParameterAttribute("metadataHeaders", Google.Apis.Util.RequestParameterType.Query)]
                public virtual Google.Apis.Util.Repeatable<string> MetadataHeaders { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "get"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/{id}"; }
                }

                /// <summary>Initializes Get parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "format", new Google.Apis.Discovery.Parameter
                        {
                            Name = "format",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "full",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "metadataHeaders", new Google.Apis.Discovery.Parameter
                        {
                            Name = "metadataHeaders",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Imports a message into only this user's mailbox, with standard email delivery scanning and
            /// classification similar to receiving via SMTP. Does not send a message.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ImportRequest Import(Google.Apis.Gmail.v1.Data.Message body, string userId)
            {
                return new ImportRequest(service, body, userId);
            }

            /// <summary>Imports a message into only this user's mailbox, with standard email delivery scanning and
            /// classification similar to receiving via SMTP. Does not send a message.</summary>
            public class ImportRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Import request.</summary>
                public ImportRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a
                /// Vault administrator. Only used for G Suite accounts.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("deleted", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> Deleted { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                /// [default: dateHeader]
                [Google.Apis.Util.RequestParameterAttribute("internalDateSource", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<InternalDateSourceEnum> InternalDateSource { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                public enum InternalDateSourceEnum
                {
                    [Google.Apis.Util.StringValueAttribute("dateHeader")]
                    DateHeader,
                    [Google.Apis.Util.StringValueAttribute("receivedTime")]
                    ReceivedTime,
                }

                /// <summary>Ignore the Gmail spam classifier decision and never mark this email as SPAM in the
                /// mailbox.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("neverMarkSpam", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> NeverMarkSpam { get; set; }

                /// <summary>Process calendar invites in the email and add any extracted meetings to the Google Calendar
                /// for this user.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("processForCalendar", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> ProcessForCalendar { get; set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Message Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "import"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/import"; }
                }

                /// <summary>Initializes Import parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "deleted", new Google.Apis.Discovery.Parameter
                        {
                            Name = "deleted",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "internalDateSource", new Google.Apis.Discovery.Parameter
                        {
                            Name = "internalDateSource",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "dateHeader",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "neverMarkSpam", new Google.Apis.Discovery.Parameter
                        {
                            Name = "neverMarkSpam",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "processForCalendar", new Google.Apis.Discovery.Parameter
                        {
                            Name = "processForCalendar",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Imports a message into only this user's mailbox, with standard email delivery scanning and
            /// classification similar to receiving via SMTP. Does not send a message.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual ImportMediaUpload Import(Google.Apis.Gmail.v1.Data.Message body, string userId, System.IO.Stream stream, string contentType)
            {
                return new ImportMediaUpload(service, body, userId, stream, contentType);
            }

            /// <summary>Import media upload which supports resumable upload.</summary>
            public class ImportMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Message, Google.Apis.Gmail.v1.Data.Message>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a
                /// Vault administrator. Only used for G Suite accounts.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("deleted", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> Deleted { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                /// [default: dateHeader]
                [Google.Apis.Util.RequestParameterAttribute("internalDateSource", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<InternalDateSourceEnum> InternalDateSource { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                public enum InternalDateSourceEnum
                {
                    [Google.Apis.Util.StringValueAttribute("dateHeader")]
                    DateHeader,
                    [Google.Apis.Util.StringValueAttribute("receivedTime")]
                    ReceivedTime,
                }

                /// <summary>Ignore the Gmail spam classifier decision and never mark this email as SPAM in the
                /// mailbox.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("neverMarkSpam", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> NeverMarkSpam { get; set; }

                /// <summary>Process calendar invites in the email and add any extracted meetings to the Google Calendar
                /// for this user.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("processForCalendar", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> ProcessForCalendar { get; set; }

                /// <summary>Constructs a new Import media upload instance.</summary>
                public ImportMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string
                 userId, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/messages/import"), "POST", stream, contentType)
                {
                    UserId = userId;
                    Body = body;
                }
            }

            /// <summary>Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most
            /// scanning and classification. Does not send a message.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual InsertRequest Insert(Google.Apis.Gmail.v1.Data.Message body, string userId)
            {
                return new InsertRequest(service, body, userId);
            }

            /// <summary>Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most
            /// scanning and classification. Does not send a message.</summary>
            public class InsertRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Insert request.</summary>
                public InsertRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a
                /// Vault administrator. Only used for G Suite accounts.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("deleted", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> Deleted { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                /// [default: receivedTime]
                [Google.Apis.Util.RequestParameterAttribute("internalDateSource", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<InternalDateSourceEnum> InternalDateSource { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                public enum InternalDateSourceEnum
                {
                    [Google.Apis.Util.StringValueAttribute("dateHeader")]
                    DateHeader,
                    [Google.Apis.Util.StringValueAttribute("receivedTime")]
                    ReceivedTime,
                }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Message Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "insert"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages"; }
                }

                /// <summary>Initializes Insert parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "deleted", new Google.Apis.Discovery.Parameter
                        {
                            Name = "deleted",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "internalDateSource", new Google.Apis.Discovery.Parameter
                        {
                            Name = "internalDateSource",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "receivedTime",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most
            /// scanning and classification. Does not send a message.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual InsertMediaUpload Insert(Google.Apis.Gmail.v1.Data.Message body, string userId, System.IO.Stream stream, string contentType)
            {
                return new InsertMediaUpload(service, body, userId, stream, contentType);
            }

            /// <summary>Insert media upload which supports resumable upload.</summary>
            public class InsertMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Message, Google.Apis.Gmail.v1.Data.Message>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a
                /// Vault administrator. Only used for G Suite accounts.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("deleted", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> Deleted { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                /// [default: receivedTime]
                [Google.Apis.Util.RequestParameterAttribute("internalDateSource", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<InternalDateSourceEnum> InternalDateSource { get; set; }

                /// <summary>Source for Gmail's internal date of the message.</summary>
                public enum InternalDateSourceEnum
                {
                    [Google.Apis.Util.StringValueAttribute("dateHeader")]
                    DateHeader,
                    [Google.Apis.Util.StringValueAttribute("receivedTime")]
                    ReceivedTime,
                }

                /// <summary>Constructs a new Insert media upload instance.</summary>
                public InsertMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string
                 userId, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/messages"), "POST", stream, contentType)
                {
                    UserId = userId;
                    Body = body;
                }
            }

            /// <summary>Lists the messages in the user's mailbox.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ListRequest List(string userId)
            {
                return new ListRequest(service, userId);
            }

            /// <summary>Lists the messages in the user's mailbox.</summary>
            public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListMessagesResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Include messages from SPAM and TRASH in the results.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("includeSpamTrash", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> IncludeSpamTrash { get; set; }

                /// <summary>Only return messages with labels that match all of the specified label IDs.</summary>
                [Google.Apis.Util.RequestParameterAttribute("labelIds", Google.Apis.Util.RequestParameterType.Query)]
                public virtual Google.Apis.Util.Repeatable<string> LabelIds { get; set; }

                /// <summary>Maximum number of messages to return.</summary>
                /// [default: 100]
                [Google.Apis.Util.RequestParameterAttribute("maxResults", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<long> MaxResults { get; set; }

                /// <summary>Page token to retrieve a specific page of results in the list.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string PageToken { get; set; }

                /// <summary>Only return messages matching the specified query. Supports the same query format as the
                /// Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot
                /// be used when accessing the api using the gmail.metadata scope.</summary>
                [Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Q { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "includeSpamTrash", new Google.Apis.Discovery.Parameter
                        {
                            Name = "includeSpamTrash",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "labelIds", new Google.Apis.Discovery.Parameter
                        {
                            Name = "labelIds",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "maxResults", new Google.Apis.Discovery.Parameter
                        {
                            Name = "maxResults",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "100",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "pageToken", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageToken",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "q", new Google.Apis.Discovery.Parameter
                        {
                            Name = "q",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Modifies the labels on the specified message.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the message to modify.</param>
            public virtual ModifyRequest Modify(Google.Apis.Gmail.v1.Data.ModifyMessageRequest body, string userId, string id)
            {
                return new ModifyRequest(service, body, userId, id);
            }

            /// <summary>Modifies the labels on the specified message.</summary>
            public class ModifyRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Modify request.</summary>
                public ModifyRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.ModifyMessageRequest body, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the message to modify.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.ModifyMessageRequest Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "modify"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/{id}/modify"; }
                }

                /// <summary>Initializes Modify parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Sends the specified message to the recipients in the To, Cc, and Bcc headers.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual SendRequest Send(Google.Apis.Gmail.v1.Data.Message body, string userId)
            {
                return new SendRequest(service, body, userId);
            }

            /// <summary>Sends the specified message to the recipients in the To, Cc, and Bcc headers.</summary>
            public class SendRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Send request.</summary>
                public SendRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.Message Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "send"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/send"; }
                }

                /// <summary>Initializes Send parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Sends the specified message to the recipients in the To, Cc, and Bcc headers.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="stream">The stream to upload.</param>
            /// <param name="contentType">The content type of the stream to upload.</param>
            public virtual SendMediaUpload Send(Google.Apis.Gmail.v1.Data.Message body, string userId, System.IO.Stream stream, string contentType)
            {
                return new SendMediaUpload(service, body, userId, stream, contentType);
            }

            /// <summary>Send media upload which supports resumable upload.</summary>
            public class SendMediaUpload : Google.Apis.Upload.ResumableUpload<Google.Apis.Gmail.v1.Data.Message, Google.Apis.Gmail.v1.Data.Message>
            {

                /// <summary>Data format for the response.</summary>
                /// [default: json]
                [Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<AltEnum> Alt { get; set; }

                /// <summary>Data format for the response.</summary>
                public enum AltEnum
                {
                    /// <summary>Responses with Content-Type of application/json</summary>
                    [Google.Apis.Util.StringValueAttribute("json")]
                    Json,
                }

                /// <summary>Selector specifying which fields to include in a partial response.</summary>
                [Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Fields { get; set; }

                /// <summary>API key. Your API key identifies your project and provides you with API access, quota, and
                /// reports. Required unless you provide an OAuth 2.0 token.</summary>
                [Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Key { get; set; }

                /// <summary>OAuth 2.0 token for the current user.</summary>
                [Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string OauthToken { get; set; }

                /// <summary>Returns response with indentations and line breaks.</summary>
                /// [default: true]
                [Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> PrettyPrint { get; set; }

                /// <summary>Available to use for quota purposes for server-side applications. Can be any arbitrary
                /// string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are
                /// provided.</summary>
                [Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string QuotaUser { get; set; }

                /// <summary>IP address of the site where the request originates. Use this if you want to enforce per-
                /// user limits.</summary>
                [Google.Apis.Util.RequestParameterAttribute("userIp", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string UserIp { get; set; }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Constructs a new Send media upload instance.</summary>
                public SendMediaUpload(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Message body, string
                 userId, System.IO.Stream stream, string contentType)
                    : base(service, string.Format("/{0}/{1}{2}", "upload", service.BasePath, "{userId}/messages/send"), "POST", stream, contentType)
                {
                    UserId = userId;
                    Body = body;
                }
            }

            /// <summary>Moves the specified message to the trash.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the message to Trash.</param>
            public virtual TrashRequest Trash(string userId, string id)
            {
                return new TrashRequest(service, userId, id);
            }

            /// <summary>Moves the specified message to the trash.</summary>
            public class TrashRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Trash request.</summary>
                public TrashRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the message to Trash.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "trash"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/{id}/trash"; }
                }

                /// <summary>Initializes Trash parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Removes the specified message from the trash.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the message to remove from Trash.</param>
            public virtual UntrashRequest Untrash(string userId, string id)
            {
                return new UntrashRequest(service, userId, id);
            }

            /// <summary>Removes the specified message from the trash.</summary>
            public class UntrashRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Message>
            {
                /// <summary>Constructs a new Untrash request.</summary>
                public UntrashRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the message to remove from Trash.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "untrash"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/messages/{id}/untrash"; }
                }

                /// <summary>Initializes Untrash parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }
        }
        private readonly SettingsResource settings;

        /// <summary>Gets the Settings resource.</summary>
        public virtual SettingsResource Settings
        {
            get { return settings; }
        }

        /// <summary>The "settings" collection of methods.</summary>
        public class SettingsResource
        {
            private const string Resource = "settings";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public SettingsResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;
                filters = new FiltersResource(service);
                forwardingAddresses = new ForwardingAddressesResource(service);
                sendAs = new SendAsResource(service);

            }

            private readonly FiltersResource filters;

            /// <summary>Gets the Filters resource.</summary>
            public virtual FiltersResource Filters
            {
                get { return filters; }
            }

            /// <summary>The "filters" collection of methods.</summary>
            public class FiltersResource
            {
                private const string Resource = "filters";

                /// <summary>The service which this resource belongs to.</summary>
                private readonly Google.Apis.Services.IClientService service;

                /// <summary>Constructs a new resource.</summary>
                public FiltersResource(Google.Apis.Services.IClientService service)
                {
                    this.service = service;

                }


                /// <summary>Creates a filter.</summary>
                /// <param name="body">The body of the request.</param>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual CreateRequest Create(Google.Apis.Gmail.v1.Data.Filter body, string userId)
                {
                    return new CreateRequest(service, body, userId);
                }

                /// <summary>Creates a filter.</summary>
                public class CreateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Filter>
                {
                    /// <summary>Constructs a new Create request.</summary>
                    public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.Filter body, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        Body = body;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    /// <summary>Gets or sets the body of this request.</summary>
                    Google.Apis.Gmail.v1.Data.Filter Body { get; set; }

                    ///<summary>Returns the body of the request.</summary>
                    protected override object GetBody() { return Body; }

                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "create"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "POST"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/filters"; }
                    }

                    /// <summary>Initializes Create parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Deletes a filter.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="id">The ID of the filter to be deleted.</param>
                public virtual DeleteRequest Delete(string userId, string id)
                {
                    return new DeleteRequest(service, userId, id);
                }

                /// <summary>Deletes a filter.</summary>
                public class DeleteRequest : GmailBaseServiceRequest<string>
                {
                    /// <summary>Constructs a new Delete request.</summary>
                    public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string id)
                        : base(service)
                    {
                        UserId = userId;
                        Id = id;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The ID of the filter to be deleted.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string Id { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "delete"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "DELETE"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/filters/{id}"; }
                    }

                    /// <summary>Initializes Delete parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "id", new Google.Apis.Discovery.Parameter
                            {
                                Name = "id",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Gets a filter.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="id">The ID of the filter to be fetched.</param>
                public virtual GetRequest Get(string userId, string id)
                {
                    return new GetRequest(service, userId, id);
                }

                /// <summary>Gets a filter.</summary>
                public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Filter>
                {
                    /// <summary>Constructs a new Get request.</summary>
                    public GetRequest(Google.Apis.Services.IClientService service, string userId, string id)
                        : base(service)
                    {
                        UserId = userId;
                        Id = id;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The ID of the filter to be fetched.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string Id { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "get"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/filters/{id}"; }
                    }

                    /// <summary>Initializes Get parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "id", new Google.Apis.Discovery.Parameter
                            {
                                Name = "id",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Lists the message filters of a Gmail user.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual ListRequest List(string userId)
                {
                    return new ListRequest(service, userId);
                }

                /// <summary>Lists the message filters of a Gmail user.</summary>
                public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListFiltersResponse>
                {
                    /// <summary>Constructs a new List request.</summary>
                    public ListRequest(Google.Apis.Services.IClientService service, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "list"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/filters"; }
                    }

                    /// <summary>Initializes List parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }
            }
            private readonly ForwardingAddressesResource forwardingAddresses;

            /// <summary>Gets the ForwardingAddresses resource.</summary>
            public virtual ForwardingAddressesResource ForwardingAddresses
            {
                get { return forwardingAddresses; }
            }

            /// <summary>The "forwardingAddresses" collection of methods.</summary>
            public class ForwardingAddressesResource
            {
                private const string Resource = "forwardingAddresses";

                /// <summary>The service which this resource belongs to.</summary>
                private readonly Google.Apis.Services.IClientService service;

                /// <summary>Constructs a new resource.</summary>
                public ForwardingAddressesResource(Google.Apis.Services.IClientService service)
                {
                    this.service = service;

                }


                /// <summary>Creates a forwarding address. If ownership verification is required, a message will be sent
                /// to the recipient and the resource's verification status will be set to pending; otherwise, the
                /// resource will be created with verification status set to accepted.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                /// <param name="body">The body of the request.</param>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual CreateRequest Create(Google.Apis.Gmail.v1.Data.ForwardingAddress body, string userId)
                {
                    return new CreateRequest(service, body, userId);
                }

                /// <summary>Creates a forwarding address. If ownership verification is required, a message will be sent
                /// to the recipient and the resource's verification status will be set to pending; otherwise, the
                /// resource will be created with verification status set to accepted.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                public class CreateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ForwardingAddress>
                {
                    /// <summary>Constructs a new Create request.</summary>
                    public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.ForwardingAddress body, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        Body = body;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    /// <summary>Gets or sets the body of this request.</summary>
                    Google.Apis.Gmail.v1.Data.ForwardingAddress Body { get; set; }

                    ///<summary>Returns the body of the request.</summary>
                    protected override object GetBody() { return Body; }

                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "create"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "POST"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/forwardingAddresses"; }
                    }

                    /// <summary>Initializes Create parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Deletes the specified forwarding address and revokes any verification that may have been
                /// required.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="forwardingEmail">The forwarding address to be deleted.</param>
                public virtual DeleteRequest Delete(string userId, string forwardingEmail)
                {
                    return new DeleteRequest(service, userId, forwardingEmail);
                }

                /// <summary>Deletes the specified forwarding address and revokes any verification that may have been
                /// required.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                public class DeleteRequest : GmailBaseServiceRequest<string>
                {
                    /// <summary>Constructs a new Delete request.</summary>
                    public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string forwardingEmail)
                        : base(service)
                    {
                        UserId = userId;
                        ForwardingEmail = forwardingEmail;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The forwarding address to be deleted.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("forwardingEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string ForwardingEmail { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "delete"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "DELETE"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/forwardingAddresses/{forwardingEmail}"; }
                    }

                    /// <summary>Initializes Delete parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "forwardingEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "forwardingEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Gets the specified forwarding address.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="forwardingEmail">The forwarding address to be retrieved.</param>
                public virtual GetRequest Get(string userId, string forwardingEmail)
                {
                    return new GetRequest(service, userId, forwardingEmail);
                }

                /// <summary>Gets the specified forwarding address.</summary>
                public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ForwardingAddress>
                {
                    /// <summary>Constructs a new Get request.</summary>
                    public GetRequest(Google.Apis.Services.IClientService service, string userId, string forwardingEmail)
                        : base(service)
                    {
                        UserId = userId;
                        ForwardingEmail = forwardingEmail;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The forwarding address to be retrieved.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("forwardingEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string ForwardingEmail { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "get"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/forwardingAddresses/{forwardingEmail}"; }
                    }

                    /// <summary>Initializes Get parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "forwardingEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "forwardingEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Lists the forwarding addresses for the specified account.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual ListRequest List(string userId)
                {
                    return new ListRequest(service, userId);
                }

                /// <summary>Lists the forwarding addresses for the specified account.</summary>
                public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListForwardingAddressesResponse>
                {
                    /// <summary>Constructs a new List request.</summary>
                    public ListRequest(Google.Apis.Services.IClientService service, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "list"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/forwardingAddresses"; }
                    }

                    /// <summary>Initializes List parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }
            }
            private readonly SendAsResource sendAs;

            /// <summary>Gets the SendAs resource.</summary>
            public virtual SendAsResource SendAs
            {
                get { return sendAs; }
            }

            /// <summary>The "sendAs" collection of methods.</summary>
            public class SendAsResource
            {
                private const string Resource = "sendAs";

                /// <summary>The service which this resource belongs to.</summary>
                private readonly Google.Apis.Services.IClientService service;

                /// <summary>Constructs a new resource.</summary>
                public SendAsResource(Google.Apis.Services.IClientService service)
                {
                    this.service = service;
                    smimeInfo = new SmimeInfoResource(service);

                }

                private readonly SmimeInfoResource smimeInfo;

                /// <summary>Gets the SmimeInfo resource.</summary>
                public virtual SmimeInfoResource SmimeInfo
                {
                    get { return smimeInfo; }
                }

                /// <summary>The "smimeInfo" collection of methods.</summary>
                public class SmimeInfoResource
                {
                    private const string Resource = "smimeInfo";

                    /// <summary>The service which this resource belongs to.</summary>
                    private readonly Google.Apis.Services.IClientService service;

                    /// <summary>Constructs a new resource.</summary>
                    public SmimeInfoResource(Google.Apis.Services.IClientService service)
                    {
                        this.service = service;

                    }


                    /// <summary>Deletes the specified S/MIME config for the specified send-as alias.</summary>
                    /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                    /// user.</param>
                    /// <param name="sendAsEmail">The email address that appears in the "From:" header for mail sent
                    /// using this alias.</param>
                    /// <param name="id">The immutable ID for the SmimeInfo.</param>
                    public virtual DeleteRequest Delete(string userId, string sendAsEmail, string id)
                    {
                        return new DeleteRequest(service, userId, sendAsEmail, id);
                    }

                    /// <summary>Deletes the specified S/MIME config for the specified send-as alias.</summary>
                    public class DeleteRequest : GmailBaseServiceRequest<string>
                    {
                        /// <summary>Constructs a new Delete request.</summary>
                        public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail, string id)
                            : base(service)
                        {
                            UserId = userId;
                            SendAsEmail = sendAsEmail;
                            Id = id;
                            InitParameters();
                        }


                        /// <summary>The user's email address. The special value me can be used to indicate the
                        /// authenticated user.</summary>
                        /// [default: me]
                        [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string UserId { get; private set; }

                        /// <summary>The email address that appears in the "From:" header for mail sent using this
                        /// alias.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string SendAsEmail { get; private set; }

                        /// <summary>The immutable ID for the SmimeInfo.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string Id { get; private set; }


                        ///<summary>Gets the method name.</summary>
                        public override string MethodName
                        {
                            get { return "delete"; }
                        }

                        ///<summary>Gets the HTTP method.</summary>
                        public override string HttpMethod
                        {
                            get { return "DELETE"; }
                        }

                        ///<summary>Gets the REST path.</summary>
                        public override string RestPath
                        {
                            get { return "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}"; }
                        }

                        /// <summary>Initializes Delete parameter list.</summary>
                        protected override void InitParameters()
                        {
                            base.InitParameters();

                            RequestParameters.Add(
                                "userId", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "userId",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = "me",
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "sendAsEmail", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "sendAsEmail",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "id", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "id",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                        }

                    }

                    /// <summary>Gets the specified S/MIME config for the specified send-as alias.</summary>
                    /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                    /// user.</param>
                    /// <param name="sendAsEmail">The email address that appears in the "From:" header for mail sent
                    /// using this alias.</param>
                    /// <param name="id">The immutable ID for the SmimeInfo.</param>
                    public virtual GetRequest Get(string userId, string sendAsEmail, string id)
                    {
                        return new GetRequest(service, userId, sendAsEmail, id);
                    }

                    /// <summary>Gets the specified S/MIME config for the specified send-as alias.</summary>
                    public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SmimeInfo>
                    {
                        /// <summary>Constructs a new Get request.</summary>
                        public GetRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail, string id)
                            : base(service)
                        {
                            UserId = userId;
                            SendAsEmail = sendAsEmail;
                            Id = id;
                            InitParameters();
                        }


                        /// <summary>The user's email address. The special value me can be used to indicate the
                        /// authenticated user.</summary>
                        /// [default: me]
                        [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string UserId { get; private set; }

                        /// <summary>The email address that appears in the "From:" header for mail sent using this
                        /// alias.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string SendAsEmail { get; private set; }

                        /// <summary>The immutable ID for the SmimeInfo.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string Id { get; private set; }


                        ///<summary>Gets the method name.</summary>
                        public override string MethodName
                        {
                            get { return "get"; }
                        }

                        ///<summary>Gets the HTTP method.</summary>
                        public override string HttpMethod
                        {
                            get { return "GET"; }
                        }

                        ///<summary>Gets the REST path.</summary>
                        public override string RestPath
                        {
                            get { return "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}"; }
                        }

                        /// <summary>Initializes Get parameter list.</summary>
                        protected override void InitParameters()
                        {
                            base.InitParameters();

                            RequestParameters.Add(
                                "userId", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "userId",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = "me",
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "sendAsEmail", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "sendAsEmail",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "id", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "id",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                        }

                    }

                    /// <summary>Insert (upload) the given S/MIME config for the specified send-as alias. Note that
                    /// pkcs12 format is required for the key.</summary>
                    /// <param name="body">The body of the request.</param>
                    /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                    /// user.</param>
                    /// <param name="sendAsEmail">The email address that appears in the "From:" header for mail sent
                    /// using this alias.</param>
                    public virtual InsertRequest Insert(Google.Apis.Gmail.v1.Data.SmimeInfo body, string userId, string sendAsEmail)
                    {
                        return new InsertRequest(service, body, userId, sendAsEmail);
                    }

                    /// <summary>Insert (upload) the given S/MIME config for the specified send-as alias. Note that
                    /// pkcs12 format is required for the key.</summary>
                    public class InsertRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SmimeInfo>
                    {
                        /// <summary>Constructs a new Insert request.</summary>
                        public InsertRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.SmimeInfo body, string userId, string sendAsEmail)
                            : base(service)
                        {
                            UserId = userId;
                            SendAsEmail = sendAsEmail;
                            Body = body;
                            InitParameters();
                        }


                        /// <summary>The user's email address. The special value me can be used to indicate the
                        /// authenticated user.</summary>
                        /// [default: me]
                        [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string UserId { get; private set; }

                        /// <summary>The email address that appears in the "From:" header for mail sent using this
                        /// alias.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string SendAsEmail { get; private set; }


                        /// <summary>Gets or sets the body of this request.</summary>
                        Google.Apis.Gmail.v1.Data.SmimeInfo Body { get; set; }

                        ///<summary>Returns the body of the request.</summary>
                        protected override object GetBody() { return Body; }

                        ///<summary>Gets the method name.</summary>
                        public override string MethodName
                        {
                            get { return "insert"; }
                        }

                        ///<summary>Gets the HTTP method.</summary>
                        public override string HttpMethod
                        {
                            get { return "POST"; }
                        }

                        ///<summary>Gets the REST path.</summary>
                        public override string RestPath
                        {
                            get { return "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo"; }
                        }

                        /// <summary>Initializes Insert parameter list.</summary>
                        protected override void InitParameters()
                        {
                            base.InitParameters();

                            RequestParameters.Add(
                                "userId", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "userId",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = "me",
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "sendAsEmail", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "sendAsEmail",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                        }

                    }

                    /// <summary>Lists S/MIME configs for the specified send-as alias.</summary>
                    /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                    /// user.</param>
                    /// <param name="sendAsEmail">The email address that appears in the "From:" header for mail sent
                    /// using this alias.</param>
                    public virtual ListRequest List(string userId, string sendAsEmail)
                    {
                        return new ListRequest(service, userId, sendAsEmail);
                    }

                    /// <summary>Lists S/MIME configs for the specified send-as alias.</summary>
                    public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListSmimeInfoResponse>
                    {
                        /// <summary>Constructs a new List request.</summary>
                        public ListRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail)
                            : base(service)
                        {
                            UserId = userId;
                            SendAsEmail = sendAsEmail;
                            InitParameters();
                        }


                        /// <summary>The user's email address. The special value me can be used to indicate the
                        /// authenticated user.</summary>
                        /// [default: me]
                        [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string UserId { get; private set; }

                        /// <summary>The email address that appears in the "From:" header for mail sent using this
                        /// alias.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string SendAsEmail { get; private set; }


                        ///<summary>Gets the method name.</summary>
                        public override string MethodName
                        {
                            get { return "list"; }
                        }

                        ///<summary>Gets the HTTP method.</summary>
                        public override string HttpMethod
                        {
                            get { return "GET"; }
                        }

                        ///<summary>Gets the REST path.</summary>
                        public override string RestPath
                        {
                            get { return "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo"; }
                        }

                        /// <summary>Initializes List parameter list.</summary>
                        protected override void InitParameters()
                        {
                            base.InitParameters();

                            RequestParameters.Add(
                                "userId", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "userId",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = "me",
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "sendAsEmail", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "sendAsEmail",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                        }

                    }

                    /// <summary>Sets the default S/MIME config for the specified send-as alias.</summary>
                    /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
                    /// user.</param>
                    /// <param name="sendAsEmail">The email address that appears in the "From:" header for mail sent
                    /// using this alias.</param>
                    /// <param name="id">The immutable ID for the SmimeInfo.</param>
                    public virtual SetDefaultRequest SetDefault(string userId, string sendAsEmail, string id)
                    {
                        return new SetDefaultRequest(service, userId, sendAsEmail, id);
                    }

                    /// <summary>Sets the default S/MIME config for the specified send-as alias.</summary>
                    public class SetDefaultRequest : GmailBaseServiceRequest<string>
                    {
                        /// <summary>Constructs a new SetDefault request.</summary>
                        public SetDefaultRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail, string id)
                            : base(service)
                        {
                            UserId = userId;
                            SendAsEmail = sendAsEmail;
                            Id = id;
                            InitParameters();
                        }


                        /// <summary>The user's email address. The special value me can be used to indicate the
                        /// authenticated user.</summary>
                        /// [default: me]
                        [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string UserId { get; private set; }

                        /// <summary>The email address that appears in the "From:" header for mail sent using this
                        /// alias.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string SendAsEmail { get; private set; }

                        /// <summary>The immutable ID for the SmimeInfo.</summary>
                        [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                        public virtual string Id { get; private set; }


                        ///<summary>Gets the method name.</summary>
                        public override string MethodName
                        {
                            get { return "setDefault"; }
                        }

                        ///<summary>Gets the HTTP method.</summary>
                        public override string HttpMethod
                        {
                            get { return "POST"; }
                        }

                        ///<summary>Gets the REST path.</summary>
                        public override string RestPath
                        {
                            get { return "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault"; }
                        }

                        /// <summary>Initializes SetDefault parameter list.</summary>
                        protected override void InitParameters()
                        {
                            base.InitParameters();

                            RequestParameters.Add(
                                "userId", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "userId",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = "me",
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "sendAsEmail", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "sendAsEmail",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                            RequestParameters.Add(
                                "id", new Google.Apis.Discovery.Parameter
                                {
                                    Name = "id",
                                    IsRequired = true,
                                    ParameterType = "path",
                                    DefaultValue = null,
                                    Pattern = null,
                                });
                        }

                    }
                }

                /// <summary>Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will attempt to
                /// connect to the SMTP service to validate the configuration before creating the alias. If ownership
                /// verification is required for the alias, a message will be sent to the email address and the
                /// resource's verification status will be set to pending; otherwise, the resource will be created with
                /// verification status set to accepted. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                /// <param name="body">The body of the request.</param>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual CreateRequest Create(Google.Apis.Gmail.v1.Data.SendAs body, string userId)
                {
                    return new CreateRequest(service, body, userId);
                }

                /// <summary>Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will attempt to
                /// connect to the SMTP service to validate the configuration before creating the alias. If ownership
                /// verification is required for the alias, a message will be sent to the email address and the
                /// resource's verification status will be set to pending; otherwise, the resource will be created with
                /// verification status set to accepted. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                public class CreateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SendAs>
                {
                    /// <summary>Constructs a new Create request.</summary>
                    public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.SendAs body, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        Body = body;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    /// <summary>Gets or sets the body of this request.</summary>
                    Google.Apis.Gmail.v1.Data.SendAs Body { get; set; }

                    ///<summary>Returns the body of the request.</summary>
                    protected override object GetBody() { return Body; }

                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "create"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "POST"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs"; }
                    }

                    /// <summary>Initializes Create parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Deletes the specified send-as alias. Revokes any verification that may have been required
                /// for using it.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="sendAsEmail">The send-as alias to be deleted.</param>
                public virtual DeleteRequest Delete(string userId, string sendAsEmail)
                {
                    return new DeleteRequest(service, userId, sendAsEmail);
                }

                /// <summary>Deletes the specified send-as alias. Revokes any verification that may have been required
                /// for using it.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                public class DeleteRequest : GmailBaseServiceRequest<string>
                {
                    /// <summary>Constructs a new Delete request.</summary>
                    public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail)
                        : base(service)
                    {
                        UserId = userId;
                        SendAsEmail = sendAsEmail;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The send-as alias to be deleted.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string SendAsEmail { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "delete"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "DELETE"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs/{sendAsEmail}"; }
                    }

                    /// <summary>Initializes Delete parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "sendAsEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "sendAsEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is
                /// not a member of the collection.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="sendAsEmail">The send-as alias to be retrieved.</param>
                public virtual GetRequest Get(string userId, string sendAsEmail)
                {
                    return new GetRequest(service, userId, sendAsEmail);
                }

                /// <summary>Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is
                /// not a member of the collection.</summary>
                public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SendAs>
                {
                    /// <summary>Constructs a new Get request.</summary>
                    public GetRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail)
                        : base(service)
                    {
                        UserId = userId;
                        SendAsEmail = sendAsEmail;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The send-as alias to be retrieved.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string SendAsEmail { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "get"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs/{sendAsEmail}"; }
                    }

                    /// <summary>Initializes Get parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "sendAsEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "sendAsEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Lists the send-as aliases for the specified account. The result includes the primary send-
                /// as address associated with the account as well as any custom "from" aliases.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                public virtual ListRequest List(string userId)
                {
                    return new ListRequest(service, userId);
                }

                /// <summary>Lists the send-as aliases for the specified account. The result includes the primary send-
                /// as address associated with the account as well as any custom "from" aliases.</summary>
                public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListSendAsResponse>
                {
                    /// <summary>Constructs a new List request.</summary>
                    public ListRequest(Google.Apis.Services.IClientService service, string userId)
                        : base(service)
                    {
                        UserId = userId;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "list"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "GET"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs"; }
                    }

                    /// <summary>Initializes List parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// Addresses other than the primary address for the account can only be updated by service account
                /// clients that have been delegated domain-wide authority. This method supports patch
                /// semantics.</summary>
                /// <param name="body">The body of the request.</param>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="sendAsEmail">The send-as alias to be updated.</param>
                public virtual PatchRequest Patch(Google.Apis.Gmail.v1.Data.SendAs body, string userId, string sendAsEmail)
                {
                    return new PatchRequest(service, body, userId, sendAsEmail);
                }

                /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// Addresses other than the primary address for the account can only be updated by service account
                /// clients that have been delegated domain-wide authority. This method supports patch
                /// semantics.</summary>
                public class PatchRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SendAs>
                {
                    /// <summary>Constructs a new Patch request.</summary>
                    public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.SendAs body, string userId, string sendAsEmail)
                        : base(service)
                    {
                        UserId = userId;
                        SendAsEmail = sendAsEmail;
                        Body = body;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The send-as alias to be updated.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string SendAsEmail { get; private set; }


                    /// <summary>Gets or sets the body of this request.</summary>
                    Google.Apis.Gmail.v1.Data.SendAs Body { get; set; }

                    ///<summary>Returns the body of the request.</summary>
                    protected override object GetBody() { return Body; }

                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "patch"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "PATCH"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs/{sendAsEmail}"; }
                    }

                    /// <summary>Initializes Patch parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "sendAsEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "sendAsEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// Addresses other than the primary address for the account can only be updated by service account
                /// clients that have been delegated domain-wide authority.</summary>
                /// <param name="body">The body of the request.</param>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="sendAsEmail">The send-as alias to be updated.</param>
                public virtual UpdateRequest Update(Google.Apis.Gmail.v1.Data.SendAs body, string userId, string sendAsEmail)
                {
                    return new UpdateRequest(service, body, userId, sendAsEmail);
                }

                /// <summary>Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before
                /// saving it with the alias.
                ///
                /// Addresses other than the primary address for the account can only be updated by service account
                /// clients that have been delegated domain-wide authority.</summary>
                public class UpdateRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.SendAs>
                {
                    /// <summary>Constructs a new Update request.</summary>
                    public UpdateRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.SendAs body, string userId, string sendAsEmail)
                        : base(service)
                    {
                        UserId = userId;
                        SendAsEmail = sendAsEmail;
                        Body = body;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The send-as alias to be updated.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string SendAsEmail { get; private set; }


                    /// <summary>Gets or sets the body of this request.</summary>
                    Google.Apis.Gmail.v1.Data.SendAs Body { get; set; }

                    ///<summary>Returns the body of the request.</summary>
                    protected override object GetBody() { return Body; }

                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "update"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "PUT"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs/{sendAsEmail}"; }
                    }

                    /// <summary>Initializes Update parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "sendAsEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "sendAsEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }

                /// <summary>Sends a verification email to the specified send-as alias address. The verification status
                /// must be pending.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</param>
                /// <param name="sendAsEmail">The send-as alias to be verified.</param>
                public virtual VerifyRequest Verify(string userId, string sendAsEmail)
                {
                    return new VerifyRequest(service, userId, sendAsEmail);
                }

                /// <summary>Sends a verification email to the specified send-as alias address. The verification status
                /// must be pending.
                ///
                /// This method is only available to service account clients that have been delegated domain-wide
                /// authority.</summary>
                public class VerifyRequest : GmailBaseServiceRequest<string>
                {
                    /// <summary>Constructs a new Verify request.</summary>
                    public VerifyRequest(Google.Apis.Services.IClientService service, string userId, string sendAsEmail)
                        : base(service)
                    {
                        UserId = userId;
                        SendAsEmail = sendAsEmail;
                        InitParameters();
                    }


                    /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                    /// user.</summary>
                    /// [default: me]
                    [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string UserId { get; private set; }

                    /// <summary>The send-as alias to be verified.</summary>
                    [Google.Apis.Util.RequestParameterAttribute("sendAsEmail", Google.Apis.Util.RequestParameterType.Path)]
                    public virtual string SendAsEmail { get; private set; }


                    ///<summary>Gets the method name.</summary>
                    public override string MethodName
                    {
                        get { return "verify"; }
                    }

                    ///<summary>Gets the HTTP method.</summary>
                    public override string HttpMethod
                    {
                        get { return "POST"; }
                    }

                    ///<summary>Gets the REST path.</summary>
                    public override string RestPath
                    {
                        get { return "{userId}/settings/sendAs/{sendAsEmail}/verify"; }
                    }

                    /// <summary>Initializes Verify parameter list.</summary>
                    protected override void InitParameters()
                    {
                        base.InitParameters();

                        RequestParameters.Add(
                            "userId", new Google.Apis.Discovery.Parameter
                            {
                                Name = "userId",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = "me",
                                Pattern = null,
                            });
                        RequestParameters.Add(
                            "sendAsEmail", new Google.Apis.Discovery.Parameter
                            {
                                Name = "sendAsEmail",
                                IsRequired = true,
                                ParameterType = "path",
                                DefaultValue = null,
                                Pattern = null,
                            });
                    }

                }
            }

            /// <summary>Gets the auto-forwarding setting for the specified account.</summary>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual GetAutoForwardingRequest GetAutoForwarding(string userId)
            {
                return new GetAutoForwardingRequest(service, userId);
            }

            /// <summary>Gets the auto-forwarding setting for the specified account.</summary>
            public class GetAutoForwardingRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.AutoForwarding>
            {
                /// <summary>Constructs a new GetAutoForwarding request.</summary>
                public GetAutoForwardingRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "getAutoForwarding"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/autoForwarding"; }
                }

                /// <summary>Initializes GetAutoForwarding parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets IMAP settings.</summary>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual GetImapRequest GetImap(string userId)
            {
                return new GetImapRequest(service, userId);
            }

            /// <summary>Gets IMAP settings.</summary>
            public class GetImapRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ImapSettings>
            {
                /// <summary>Constructs a new GetImap request.</summary>
                public GetImapRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "getImap"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/imap"; }
                }

                /// <summary>Initializes GetImap parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets POP settings.</summary>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual GetPopRequest GetPop(string userId)
            {
                return new GetPopRequest(service, userId);
            }

            /// <summary>Gets POP settings.</summary>
            public class GetPopRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.PopSettings>
            {
                /// <summary>Constructs a new GetPop request.</summary>
                public GetPopRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "getPop"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/pop"; }
                }

                /// <summary>Initializes GetPop parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets vacation responder settings.</summary>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual GetVacationRequest GetVacation(string userId)
            {
                return new GetVacationRequest(service, userId);
            }

            /// <summary>Gets vacation responder settings.</summary>
            public class GetVacationRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.VacationSettings>
            {
                /// <summary>Constructs a new GetVacation request.</summary>
                public GetVacationRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "getVacation"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/vacation"; }
                }

                /// <summary>Initializes GetVacation parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates the auto-forwarding setting for the specified account. A verified forwarding address
            /// must be specified when auto-forwarding is enabled.
            ///
            /// This method is only available to service account clients that have been delegated domain-wide
            /// authority.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual UpdateAutoForwardingRequest UpdateAutoForwarding(Google.Apis.Gmail.v1.Data.AutoForwarding body, string userId)
            {
                return new UpdateAutoForwardingRequest(service, body, userId);
            }

            /// <summary>Updates the auto-forwarding setting for the specified account. A verified forwarding address
            /// must be specified when auto-forwarding is enabled.
            ///
            /// This method is only available to service account clients that have been delegated domain-wide
            /// authority.</summary>
            public class UpdateAutoForwardingRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.AutoForwarding>
            {
                /// <summary>Constructs a new UpdateAutoForwarding request.</summary>
                public UpdateAutoForwardingRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.AutoForwarding body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.AutoForwarding Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "updateAutoForwarding"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/autoForwarding"; }
                }

                /// <summary>Initializes UpdateAutoForwarding parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates IMAP settings.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual UpdateImapRequest UpdateImap(Google.Apis.Gmail.v1.Data.ImapSettings body, string userId)
            {
                return new UpdateImapRequest(service, body, userId);
            }

            /// <summary>Updates IMAP settings.</summary>
            public class UpdateImapRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ImapSettings>
            {
                /// <summary>Constructs a new UpdateImap request.</summary>
                public UpdateImapRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.ImapSettings body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.ImapSettings Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "updateImap"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/imap"; }
                }

                /// <summary>Initializes UpdateImap parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates POP settings.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual UpdatePopRequest UpdatePop(Google.Apis.Gmail.v1.Data.PopSettings body, string userId)
            {
                return new UpdatePopRequest(service, body, userId);
            }

            /// <summary>Updates POP settings.</summary>
            public class UpdatePopRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.PopSettings>
            {
                /// <summary>Constructs a new UpdatePop request.</summary>
                public UpdatePopRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.PopSettings body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.PopSettings Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "updatePop"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/pop"; }
                }

                /// <summary>Initializes UpdatePop parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }

            /// <summary>Updates vacation responder settings.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">User's email address. The special value "me" can be used to indicate the authenticated
            /// user.</param>
            public virtual UpdateVacationRequest UpdateVacation(Google.Apis.Gmail.v1.Data.VacationSettings body, string userId)
            {
                return new UpdateVacationRequest(service, body, userId);
            }

            /// <summary>Updates vacation responder settings.</summary>
            public class UpdateVacationRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.VacationSettings>
            {
                /// <summary>Constructs a new UpdateVacation request.</summary>
                public UpdateVacationRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.VacationSettings body, string userId)
                    : base(service)
                {
                    UserId = userId;
                    Body = body;
                    InitParameters();
                }


                /// <summary>User's email address. The special value "me" can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.VacationSettings Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "updateVacation"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "PUT"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/settings/vacation"; }
                }

                /// <summary>Initializes UpdateVacation parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                }

            }
        }
        private readonly ThreadsResource threads;

        /// <summary>Gets the Threads resource.</summary>
        public virtual ThreadsResource Threads
        {
            get { return threads; }
        }

        /// <summary>The "threads" collection of methods.</summary>
        public class ThreadsResource
        {
            private const string Resource = "threads";

            /// <summary>The service which this resource belongs to.</summary>
            private readonly Google.Apis.Services.IClientService service;

            /// <summary>Constructs a new resource.</summary>
            public ThreadsResource(Google.Apis.Services.IClientService service)
            {
                this.service = service;

            }


            /// <summary>Immediately and permanently deletes the specified thread. This operation cannot be undone.
            /// Prefer threads.trash instead.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">ID of the Thread to delete.</param>
            public virtual DeleteRequest Delete(string userId, string id)
            {
                return new DeleteRequest(service, userId, id);
            }

            /// <summary>Immediately and permanently deletes the specified thread. This operation cannot be undone.
            /// Prefer threads.trash instead.</summary>
            public class DeleteRequest : GmailBaseServiceRequest<string>
            {
                /// <summary>Constructs a new Delete request.</summary>
                public DeleteRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>ID of the Thread to delete.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "delete"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "DELETE"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads/{id}"; }
                }

                /// <summary>Initializes Delete parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Gets the specified thread.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the thread to retrieve.</param>
            public virtual GetRequest Get(string userId, string id)
            {
                return new GetRequest(service, userId, id);
            }

            /// <summary>Gets the specified thread.</summary>
            public class GetRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Thread>
            {
                /// <summary>Constructs a new Get request.</summary>
                public GetRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the thread to retrieve.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }

                /// <summary>The format to return the messages in.</summary>
                /// [default: full]
                [Google.Apis.Util.RequestParameterAttribute("format", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<FormatEnum> Format { get; set; }

                /// <summary>The format to return the messages in.</summary>
                public enum FormatEnum
                {
                    [Google.Apis.Util.StringValueAttribute("full")]
                    Full,
                    [Google.Apis.Util.StringValueAttribute("metadata")]
                    Metadata,
                    [Google.Apis.Util.StringValueAttribute("minimal")]
                    Minimal,
                }

                /// <summary>When given and format is METADATA, only include headers specified.</summary>
                [Google.Apis.Util.RequestParameterAttribute("metadataHeaders", Google.Apis.Util.RequestParameterType.Query)]
                public virtual Google.Apis.Util.Repeatable<string> MetadataHeaders { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "get"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads/{id}"; }
                }

                /// <summary>Initializes Get parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "format", new Google.Apis.Discovery.Parameter
                        {
                            Name = "format",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "full",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "metadataHeaders", new Google.Apis.Discovery.Parameter
                        {
                            Name = "metadataHeaders",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Lists the threads in the user's mailbox.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            public virtual ListRequest List(string userId)
            {
                return new ListRequest(service, userId);
            }

            /// <summary>Lists the threads in the user's mailbox.</summary>
            public class ListRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.ListThreadsResponse>
            {
                /// <summary>Constructs a new List request.</summary>
                public ListRequest(Google.Apis.Services.IClientService service, string userId)
                    : base(service)
                {
                    UserId = userId;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>Include threads from SPAM and TRASH in the results.</summary>
                /// [default: false]
                [Google.Apis.Util.RequestParameterAttribute("includeSpamTrash", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<bool> IncludeSpamTrash { get; set; }

                /// <summary>Only return threads with labels that match all of the specified label IDs.</summary>
                [Google.Apis.Util.RequestParameterAttribute("labelIds", Google.Apis.Util.RequestParameterType.Query)]
                public virtual Google.Apis.Util.Repeatable<string> LabelIds { get; set; }

                /// <summary>Maximum number of threads to return.</summary>
                /// [default: 100]
                [Google.Apis.Util.RequestParameterAttribute("maxResults", Google.Apis.Util.RequestParameterType.Query)]
                public virtual System.Nullable<long> MaxResults { get; set; }

                /// <summary>Page token to retrieve a specific page of results in the list.</summary>
                [Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string PageToken { get; set; }

                /// <summary>Only return threads matching the specified query. Supports the same query format as the
                /// Gmail search box. For example, "from:someuser@example.com rfc822msgid: is:unread". Parameter cannot
                /// be used when accessing the api using the gmail.metadata scope.</summary>
                [Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
                public virtual string Q { get; set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "list"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "GET"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads"; }
                }

                /// <summary>Initializes List parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "includeSpamTrash", new Google.Apis.Discovery.Parameter
                        {
                            Name = "includeSpamTrash",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "false",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "labelIds", new Google.Apis.Discovery.Parameter
                        {
                            Name = "labelIds",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "maxResults", new Google.Apis.Discovery.Parameter
                        {
                            Name = "maxResults",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = "100",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "pageToken", new Google.Apis.Discovery.Parameter
                        {
                            Name = "pageToken",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "q", new Google.Apis.Discovery.Parameter
                        {
                            Name = "q",
                            IsRequired = false,
                            ParameterType = "query",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Modifies the labels applied to the thread. This applies to all messages in the
            /// thread.</summary>
            /// <param name="body">The body of the request.</param>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the thread to modify.</param>
            public virtual ModifyRequest Modify(Google.Apis.Gmail.v1.Data.ModifyThreadRequest body, string userId, string id)
            {
                return new ModifyRequest(service, body, userId, id);
            }

            /// <summary>Modifies the labels applied to the thread. This applies to all messages in the
            /// thread.</summary>
            public class ModifyRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Thread>
            {
                /// <summary>Constructs a new Modify request.</summary>
                public ModifyRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.ModifyThreadRequest body, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    Body = body;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the thread to modify.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                /// <summary>Gets or sets the body of this request.</summary>
                Google.Apis.Gmail.v1.Data.ModifyThreadRequest Body { get; set; }

                ///<summary>Returns the body of the request.</summary>
                protected override object GetBody() { return Body; }

                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "modify"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads/{id}/modify"; }
                }

                /// <summary>Initializes Modify parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Moves the specified thread to the trash.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the thread to Trash.</param>
            public virtual TrashRequest Trash(string userId, string id)
            {
                return new TrashRequest(service, userId, id);
            }

            /// <summary>Moves the specified thread to the trash.</summary>
            public class TrashRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Thread>
            {
                /// <summary>Constructs a new Trash request.</summary>
                public TrashRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the thread to Trash.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "trash"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads/{id}/trash"; }
                }

                /// <summary>Initializes Trash parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }

            /// <summary>Removes the specified thread from the trash.</summary>
            /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
            /// user.</param>
            /// <param name="id">The ID of the thread to remove from Trash.</param>
            public virtual UntrashRequest Untrash(string userId, string id)
            {
                return new UntrashRequest(service, userId, id);
            }

            /// <summary>Removes the specified thread from the trash.</summary>
            public class UntrashRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Thread>
            {
                /// <summary>Constructs a new Untrash request.</summary>
                public UntrashRequest(Google.Apis.Services.IClientService service, string userId, string id)
                    : base(service)
                {
                    UserId = userId;
                    Id = id;
                    InitParameters();
                }


                /// <summary>The user's email address. The special value me can be used to indicate the authenticated
                /// user.</summary>
                /// [default: me]
                [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string UserId { get; private set; }

                /// <summary>The ID of the thread to remove from Trash.</summary>
                [Google.Apis.Util.RequestParameterAttribute("id", Google.Apis.Util.RequestParameterType.Path)]
                public virtual string Id { get; private set; }


                ///<summary>Gets the method name.</summary>
                public override string MethodName
                {
                    get { return "untrash"; }
                }

                ///<summary>Gets the HTTP method.</summary>
                public override string HttpMethod
                {
                    get { return "POST"; }
                }

                ///<summary>Gets the REST path.</summary>
                public override string RestPath
                {
                    get { return "{userId}/threads/{id}/untrash"; }
                }

                /// <summary>Initializes Untrash parameter list.</summary>
                protected override void InitParameters()
                {
                    base.InitParameters();

                    RequestParameters.Add(
                        "userId", new Google.Apis.Discovery.Parameter
                        {
                            Name = "userId",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = "me",
                            Pattern = null,
                        });
                    RequestParameters.Add(
                        "id", new Google.Apis.Discovery.Parameter
                        {
                            Name = "id",
                            IsRequired = true,
                            ParameterType = "path",
                            DefaultValue = null,
                            Pattern = null,
                        });
                }

            }
        }

        /// <summary>Gets the current user's Gmail profile.</summary>
        /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
        /// user.</param>
        public virtual GetProfileRequest GetProfile(string userId)
        {
            return new GetProfileRequest(service, userId);
        }

        /// <summary>Gets the current user's Gmail profile.</summary>
        public class GetProfileRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.Profile>
        {
            /// <summary>Constructs a new GetProfile request.</summary>
            public GetProfileRequest(Google.Apis.Services.IClientService service, string userId)
                : base(service)
            {
                UserId = userId;
                InitParameters();
            }


            /// <summary>The user's email address. The special value me can be used to indicate the authenticated
            /// user.</summary>
            /// [default: me]
            [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string UserId { get; private set; }


            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "getProfile"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "GET"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "{userId}/profile"; }
            }

            /// <summary>Initializes GetProfile parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "userId", new Google.Apis.Discovery.Parameter
                    {
                        Name = "userId",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = "me",
                        Pattern = null,
                    });
            }

        }

        /// <summary>Stop receiving push notifications for the given user mailbox.</summary>
        /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
        /// user.</param>
        public virtual StopRequest Stop(string userId)
        {
            return new StopRequest(service, userId);
        }

        /// <summary>Stop receiving push notifications for the given user mailbox.</summary>
        public class StopRequest : GmailBaseServiceRequest<string>
        {
            /// <summary>Constructs a new Stop request.</summary>
            public StopRequest(Google.Apis.Services.IClientService service, string userId)
                : base(service)
            {
                UserId = userId;
                InitParameters();
            }


            /// <summary>The user's email address. The special value me can be used to indicate the authenticated
            /// user.</summary>
            /// [default: me]
            [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string UserId { get; private set; }


            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "stop"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "POST"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "{userId}/stop"; }
            }

            /// <summary>Initializes Stop parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "userId", new Google.Apis.Discovery.Parameter
                    {
                        Name = "userId",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = "me",
                        Pattern = null,
                    });
            }

        }

        /// <summary>Set up or update a push notification watch on the given user mailbox.</summary>
        /// <param name="body">The body of the request.</param>
        /// <param name="userId">The user's email address. The special value me can be used to indicate the authenticated
        /// user.</param>
        public virtual WatchRequest Watch(Google.Apis.Gmail.v1.Data.WatchRequest body, string userId)
        {
            return new WatchRequest(service, body, userId);
        }

        /// <summary>Set up or update a push notification watch on the given user mailbox.</summary>
        public class WatchRequest : GmailBaseServiceRequest<Google.Apis.Gmail.v1.Data.WatchResponse>
        {
            /// <summary>Constructs a new Watch request.</summary>
            public WatchRequest(Google.Apis.Services.IClientService service, Google.Apis.Gmail.v1.Data.WatchRequest body, string userId)
                : base(service)
            {
                UserId = userId;
                Body = body;
                InitParameters();
            }


            /// <summary>The user's email address. The special value me can be used to indicate the authenticated
            /// user.</summary>
            /// [default: me]
            [Google.Apis.Util.RequestParameterAttribute("userId", Google.Apis.Util.RequestParameterType.Path)]
            public virtual string UserId { get; private set; }


            /// <summary>Gets or sets the body of this request.</summary>
            Google.Apis.Gmail.v1.Data.WatchRequest Body { get; set; }

            ///<summary>Returns the body of the request.</summary>
            protected override object GetBody() { return Body; }

            ///<summary>Gets the method name.</summary>
            public override string MethodName
            {
                get { return "watch"; }
            }

            ///<summary>Gets the HTTP method.</summary>
            public override string HttpMethod
            {
                get { return "POST"; }
            }

            ///<summary>Gets the REST path.</summary>
            public override string RestPath
            {
                get { return "{userId}/watch"; }
            }

            /// <summary>Initializes Watch parameter list.</summary>
            protected override void InitParameters()
            {
                base.InitParameters();

                RequestParameters.Add(
                    "userId", new Google.Apis.Discovery.Parameter
                    {
                        Name = "userId",
                        IsRequired = true,
                        ParameterType = "path",
                        DefaultValue = "me",
                        Pattern = null,
                    });
            }

        }
    }
}

namespace Google.Apis.Gmail.v1.Data
{    

    /// <summary>Auto-forwarding settings for an account.</summary>
    public class AutoForwarding : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The state that a message should be left in after it has been forwarded.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("disposition")]
        public virtual string Disposition { get; set; } 

        /// <summary>Email address to which all incoming messages are forwarded. This email address must be a verified
        /// member of the forwarding addresses.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("emailAddress")]
        public virtual string EmailAddress { get; set; } 

        /// <summary>Whether all incoming mail is automatically forwarded to another address.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("enabled")]
        public virtual System.Nullable<bool> Enabled { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class BatchDeleteMessagesRequest : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The IDs of the messages to delete.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("ids")]
        public virtual System.Collections.Generic.IList<string> Ids { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class BatchModifyMessagesRequest : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A list of label IDs to add to messages.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("addLabelIds")]
        public virtual System.Collections.Generic.IList<string> AddLabelIds { get; set; } 

        /// <summary>The IDs of the messages to modify. There is a limit of 1000 ids per request.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("ids")]
        public virtual System.Collections.Generic.IList<string> Ids { get; set; } 

        /// <summary>A list of label IDs to remove from messages.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("removeLabelIds")]
        public virtual System.Collections.Generic.IList<string> RemoveLabelIds { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>A draft email in the user's mailbox.</summary>
    public class Draft : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The immutable ID of the draft.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>The message content of the draft.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("message")]
        public virtual Message Message { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email
    /// thread.</summary>
    public class Filter : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Action that the filter performs.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("action")]
        public virtual FilterAction Action { get; set; } 

        /// <summary>Matching criteria for the filter.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("criteria")]
        public virtual FilterCriteria Criteria { get; set; } 

        /// <summary>The server assigned ID of the filter.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>A set of actions to perform on a message.</summary>
    public class FilterAction : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of labels to add to the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("addLabelIds")]
        public virtual System.Collections.Generic.IList<string> AddLabelIds { get; set; } 

        /// <summary>Email address that the message should be forwarded to.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("forward")]
        public virtual string Forward { get; set; } 

        /// <summary>List of labels to remove from the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("removeLabelIds")]
        public virtual System.Collections.Generic.IList<string> RemoveLabelIds { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Message matching criteria.</summary>
    public class FilterCriteria : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Whether the response should exclude chats.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("excludeChats")]
        public virtual System.Nullable<bool> ExcludeChats { get; set; } 

        /// <summary>The sender's display name or email address.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("from")]
        public virtual string From { get; set; } 

        /// <summary>Whether the message has any attachment.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("hasAttachment")]
        public virtual System.Nullable<bool> HasAttachment { get; set; } 

        /// <summary>Only return messages not matching the specified query. Supports the same query format as the Gmail
        /// search box. For example, "from:someuser@example.com rfc822msgid: is:unread".</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("negatedQuery")]
        public virtual string NegatedQuery { get; set; } 

        /// <summary>Only return messages matching the specified query. Supports the same query format as the Gmail
        /// search box. For example, "from:someuser@example.com rfc822msgid: is:unread".</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("query")]
        public virtual string Query { get; set; } 

        /// <summary>The size of the entire RFC822 message in bytes, including all headers and attachments.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("size")]
        public virtual System.Nullable<int> Size { get; set; } 

        /// <summary>How the message size in bytes should be in relation to the size field.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("sizeComparison")]
        public virtual string SizeComparison { get; set; } 

        /// <summary>Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be
        /// trimmed and adjacent spaces are collapsed.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("subject")]
        public virtual string Subject { get; set; } 

        /// <summary>The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc"
        /// header fields. You can use simply the local part of the email address. For example, "example" and "example@"
        /// both match "example@gmail.com". This field is case-insensitive.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("to")]
        public virtual string To { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Settings for a forwarding address.</summary>
    public class ForwardingAddress : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>An email address to which messages can be forwarded.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("forwardingEmail")]
        public virtual string ForwardingEmail { get; set; } 

        /// <summary>Indicates whether this address has been verified and is usable for forwarding. Read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("verificationStatus")]
        public virtual string VerificationStatus { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>A record of a change to the user's mailbox. Each history change may affect multiple messages in
    /// multiple ways.</summary>
    public class History : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The mailbox sequence ID.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual System.Nullable<ulong> Id { get; set; } 

        /// <summary>Labels added to messages in this history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelsAdded")]
        public virtual System.Collections.Generic.IList<HistoryLabelAdded> LabelsAdded { get; set; } 

        /// <summary>Labels removed from messages in this history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelsRemoved")]
        public virtual System.Collections.Generic.IList<HistoryLabelRemoved> LabelsRemoved { get; set; } 

        /// <summary>List of messages changed in this history record. The fields for specific change types, such as
        /// messagesAdded may duplicate messages in this field. We recommend using the specific change-type fields
        /// instead of this.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messages")]
        public virtual System.Collections.Generic.IList<Message> Messages { get; set; } 

        /// <summary>Messages added to the mailbox in this history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messagesAdded")]
        public virtual System.Collections.Generic.IList<HistoryMessageAdded> MessagesAdded { get; set; } 

        /// <summary>Messages deleted (not Trashed) from the mailbox in this history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messagesDeleted")]
        public virtual System.Collections.Generic.IList<HistoryMessageDeleted> MessagesDeleted { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class HistoryLabelAdded : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Label IDs added to the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelIds")]
        public virtual System.Collections.Generic.IList<string> LabelIds { get; set; } 

        [Newtonsoft.Json.JsonPropertyAttribute("message")]
        public virtual Message Message { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class HistoryLabelRemoved : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Label IDs removed from the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelIds")]
        public virtual System.Collections.Generic.IList<string> LabelIds { get; set; } 

        [Newtonsoft.Json.JsonPropertyAttribute("message")]
        public virtual Message Message { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class HistoryMessageAdded : Google.Apis.Requests.IDirectResponseSchema
    {
        [Newtonsoft.Json.JsonPropertyAttribute("message")]
        public virtual Message Message { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class HistoryMessageDeleted : Google.Apis.Requests.IDirectResponseSchema
    {
        [Newtonsoft.Json.JsonPropertyAttribute("message")]
        public virtual Message Message { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>IMAP settings for an account.</summary>
    public class ImapSettings : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>If this value is true, Gmail will immediately expunge a message when it is marked as deleted in
        /// IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as
        /// deleted.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("autoExpunge")]
        public virtual System.Nullable<bool> AutoExpunge { get; set; } 

        /// <summary>Whether IMAP is enabled for the account.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("enabled")]
        public virtual System.Nullable<bool> Enabled { get; set; } 

        /// <summary>The action that will be executed on a message when it is marked as deleted and expunged from the
        /// last visible IMAP folder.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("expungeBehavior")]
        public virtual string ExpungeBehavior { get; set; } 

        /// <summary>An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0,
        /// 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("maxFolderSize")]
        public virtual System.Nullable<int> MaxFolderSize { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Labels are used to categorize messages and threads within the user's mailbox.</summary>
    public class Label : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The immutable ID of the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>The visibility of the label in the label list in the Gmail web interface.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelListVisibility")]
        public virtual string LabelListVisibility { get; set; } 

        /// <summary>The visibility of the label in the message list in the Gmail web interface.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messageListVisibility")]
        public virtual string MessageListVisibility { get; set; } 

        /// <summary>The total number of messages with the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messagesTotal")]
        public virtual System.Nullable<int> MessagesTotal { get; set; } 

        /// <summary>The number of unread messages with the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messagesUnread")]
        public virtual System.Nullable<int> MessagesUnread { get; set; } 

        /// <summary>The display name of the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("name")]
        public virtual string Name { get; set; } 

        /// <summary>The total number of threads with the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("threadsTotal")]
        public virtual System.Nullable<int> ThreadsTotal { get; set; } 

        /// <summary>The number of unread threads with the label.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("threadsUnread")]
        public virtual System.Nullable<int> ThreadsUnread { get; set; } 

        /// <summary>The owner type for the label. User labels are created by the user and can be modified and deleted
        /// by the user and can be applied to any message or thread. System labels are internally created and cannot be
        /// added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads
        /// under some circumstances but this is not guaranteed. For example, users can apply and remove the INBOX and
        /// UNREAD labels from messages and threads, but cannot apply or remove the DRAFTS or SENT labels from messages
        /// or threads.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("type")]
        public virtual string Type { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListDraftsResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of drafts.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("drafts")]
        public virtual System.Collections.Generic.IList<Draft> Drafts { get; set; } 

        /// <summary>Token to retrieve the next page of results in the list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>Estimated total number of results.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("resultSizeEstimate")]
        public virtual System.Nullable<long> ResultSizeEstimate { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Response for the ListFilters method.</summary>
    public class ListFiltersResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of a user's filters.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("filter")]
        public virtual System.Collections.Generic.IList<Filter> Filter { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Response for the ListForwardingAddresses method.</summary>
    public class ListForwardingAddressesResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of addresses that may be used for forwarding.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("forwardingAddresses")]
        public virtual System.Collections.Generic.IList<ForwardingAddress> ForwardingAddresses { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListHistoryResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of history records. Any messages contained in the response will typically only have id and
        /// threadId fields populated.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("history")]
        public virtual System.Collections.Generic.IList<History> History { get; set; } 

        /// <summary>The ID of the mailbox's current history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("historyId")]
        public virtual System.Nullable<ulong> HistoryId { get; set; } 

        /// <summary>Page token to retrieve the next page of results in the list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListLabelsResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of labels.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labels")]
        public virtual System.Collections.Generic.IList<Label> Labels { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListMessagesResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of messages.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messages")]
        public virtual System.Collections.Generic.IList<Message> Messages { get; set; } 

        /// <summary>Token to retrieve the next page of results in the list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>Estimated total number of results.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("resultSizeEstimate")]
        public virtual System.Nullable<long> ResultSizeEstimate { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Response for the ListSendAs method.</summary>
    public class ListSendAsResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of send-as aliases.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("sendAs")]
        public virtual System.Collections.Generic.IList<SendAs> SendAs { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListSmimeInfoResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>List of SmimeInfo.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("smimeInfo")]
        public virtual System.Collections.Generic.IList<SmimeInfo> SmimeInfo { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ListThreadsResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Page token to retrieve the next page of results in the list.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
        public virtual string NextPageToken { get; set; } 

        /// <summary>Estimated total number of results.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("resultSizeEstimate")]
        public virtual System.Nullable<long> ResultSizeEstimate { get; set; } 

        /// <summary>List of threads.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("threads")]
        public virtual System.Collections.Generic.IList<Thread> Threads { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>An email message.</summary>
    public class Message : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The ID of the last history record that modified this message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("historyId")]
        public virtual System.Nullable<ulong> HistoryId { get; set; } 

        /// <summary>The immutable ID of the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For
        /// normal SMTP-received email, this represents the time the message was originally accepted by Google, which is
        /// more reliable than the Date header. However, for API-migrated mail, it can be configured by client to be
        /// based on the Date header.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("internalDate")]
        public virtual System.Nullable<long> InternalDate { get; set; } 

        /// <summary>List of IDs of labels applied to this message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelIds")]
        public virtual System.Collections.Generic.IList<string> LabelIds { get; set; } 

        /// <summary>The parsed email structure in the message parts.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("payload")]
        public virtual MessagePart Payload { get; set; } 

        /// <summary>The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in
        /// messages.get and drafts.get responses when the format=RAW parameter is supplied.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("raw")]
        public virtual string Raw { get; set; } 

        /// <summary>Estimated size in bytes of the message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("sizeEstimate")]
        public virtual System.Nullable<int> SizeEstimate { get; set; } 

        /// <summary>A short part of the message text.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("snippet")]
        public virtual string Snippet { get; set; } 

        /// <summary>The ID of the thread the message belongs to. To add a message or draft to a thread, the following
        /// criteria must be met: - The requested threadId must be specified on the Message or Draft.Message you supply
        /// with your request. - The References and In-Reply-To headers must be set in compliance with the RFC 2822
        /// standard. - The Subject headers must match.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("threadId")]
        public virtual string ThreadId { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>A single MIME message part.</summary>
    public class MessagePart : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The message part body for this part, which may be empty for container MIME message parts.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("body")]
        public virtual MessagePartBody Body { get; set; } 

        /// <summary>The filename of the attachment. Only present if this message part represents an
        /// attachment.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("filename")]
        public virtual string Filename { get; set; } 

        /// <summary>List of headers on this message part. For the top-level message part, representing the entire
        /// message payload, it will contain the standard RFC 2822 email headers such as To, From, and
        /// Subject.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("headers")]
        public virtual System.Collections.Generic.IList<MessagePartHeader> Headers { get; set; } 

        /// <summary>The MIME type of the message part.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("mimeType")]
        public virtual string MimeType { get; set; } 

        /// <summary>The immutable ID of the message part.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("partId")]
        public virtual string PartId { get; set; } 

        /// <summary>The child MIME message parts of this part. This only applies to container MIME message parts, for
        /// example multipart. For non- container MIME message part types, such as text/plain, this field is empty. For
        /// more information, see RFC 1521.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("parts")]
        public virtual System.Collections.Generic.IList<MessagePart> Parts { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>The body of a single MIME message part.</summary>
    public class MessagePartBody : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>When present, contains the ID of an external attachment that can be retrieved in a separate
        /// messages.attachments.get request. When not present, the entire content of the message part body is contained
        /// in the data field.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("attachmentId")]
        public virtual string AttachmentId { get; set; } 

        /// <summary>The body data of a MIME message part as a base64url encoded string. May be empty for MIME container
        /// types that have no message body or when the body data is sent as a separate attachment. An attachment ID is
        /// present if the body data is contained in a separate attachment.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("data")]
        public virtual string Data { get; set; } 

        /// <summary>Number of bytes for the message part data (encoding notwithstanding).</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("size")]
        public virtual System.Nullable<int> Size { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class MessagePartHeader : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The name of the header before the : separator. For example, To.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("name")]
        public virtual string Name { get; set; } 

        /// <summary>The value of the header after the : separator. For example, someuser@example.com.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("value")]
        public virtual string Value { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ModifyMessageRequest : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A list of IDs of labels to add to this message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("addLabelIds")]
        public virtual System.Collections.Generic.IList<string> AddLabelIds { get; set; } 

        /// <summary>A list IDs of labels to remove from this message.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("removeLabelIds")]
        public virtual System.Collections.Generic.IList<string> RemoveLabelIds { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    public class ModifyThreadRequest : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A list of IDs of labels to add to this thread.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("addLabelIds")]
        public virtual System.Collections.Generic.IList<string> AddLabelIds { get; set; } 

        /// <summary>A list of IDs of labels to remove from this thread.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("removeLabelIds")]
        public virtual System.Collections.Generic.IList<string> RemoveLabelIds { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>POP settings for an account.</summary>
    public class PopSettings : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The range of messages which are accessible via POP.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("accessWindow")]
        public virtual string AccessWindow { get; set; } 

        /// <summary>The action that will be executed on a message after it has been fetched via POP.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("disposition")]
        public virtual string Disposition { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Profile for a Gmail user.</summary>
    public class Profile : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The user's email address.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("emailAddress")]
        public virtual string EmailAddress { get; set; } 

        /// <summary>The ID of the mailbox's current history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("historyId")]
        public virtual System.Nullable<ulong> HistoryId { get; set; } 

        /// <summary>The total number of messages in the mailbox.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messagesTotal")]
        public virtual System.Nullable<int> MessagesTotal { get; set; } 

        /// <summary>The total number of threads in the mailbox.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("threadsTotal")]
        public virtual System.Nullable<int> ThreadsTotal { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Settings associated with a send-as alias, which can be either the primary login address associated with
    /// the account or a custom "from" address. Send-as aliases correspond to the "Send Mail As" feature in the web
    /// interface.</summary>
    public class SendAs : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>A name that appears in the "From:" header for mail sent using this alias. For custom "from"
        /// addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the
        /// primary address associated with the account.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("displayName")]
        public virtual string DisplayName { get; set; } 

        /// <summary>Whether this address is selected as the default "From:" address in situations such as composing a
        /// new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address,
        /// so the only legal value that clients may write to this field is true. Changing this from false to true for
        /// an address will result in this field becoming false for the other previous default address.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("isDefault")]
        public virtual System.Nullable<bool> IsDefault { get; set; } 

        /// <summary>Whether this address is the primary address used to login to the account. Every Gmail account has
        /// exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is
        /// read-only.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("isPrimary")]
        public virtual System.Nullable<bool> IsPrimary { get; set; } 

        /// <summary>An optional email address that is included in a "Reply-To:" header for mail sent using this alias.
        /// If this is empty, Gmail will not generate a "Reply-To:" header.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("replyToAddress")]
        public virtual string ReplyToAddress { get; set; } 

        /// <summary>The email address that appears in the "From:" header for mail sent using this alias. This is read-
        /// only for all operations except create.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("sendAsEmail")]
        public virtual string SendAsEmail { get; set; } 

        /// <summary>An optional HTML signature that is included in messages composed with this alias in the Gmail web
        /// UI.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("signature")]
        public virtual string Signature { get; set; } 

        /// <summary>An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If
        /// this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service.
        /// This setting only applies to custom "from" aliases.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("smtpMsa")]
        public virtual SmtpMsa SmtpMsa { get; set; } 

        /// <summary>Whether Gmail should  treat this address as an alias for the user's primary email address. This
        /// setting only applies to custom "from" aliases.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("treatAsAlias")]
        public virtual System.Nullable<bool> TreatAsAlias { get; set; } 

        /// <summary>Indicates whether this address has been verified for use as a send-as alias. Read-only. This
        /// setting only applies to custom "from" aliases.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("verificationStatus")]
        public virtual string VerificationStatus { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>An S/MIME email config.</summary>
    public class SmimeInfo : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Encrypted key password, when key is encrypted.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("encryptedKeyPassword")]
        public virtual string EncryptedKeyPassword { get; set; } 

        /// <summary>When the certificate expires (in milliseconds since epoch).</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("expiration")]
        public virtual System.Nullable<long> Expiration { get; set; } 

        /// <summary>The immutable ID for the SmimeInfo.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>Whether this SmimeInfo is the default one for this user's send-as address.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("isDefault")]
        public virtual System.Nullable<bool> IsDefault { get; set; } 

        /// <summary>The S/MIME certificate issuer's common name.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("issuerCn")]
        public virtual string IssuerCn { get; set; } 

        /// <summary>PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for
        /// returning key, which includes public key as well as certificate chain (not private key).</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("pem")]
        public virtual string Pem { get; set; } 

        /// <summary>PKCS#12 format containing a single private/public key pair and certificate chain. This format is
        /// only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not
        /// intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set
        /// appropriately.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("pkcs12")]
        public virtual string Pkcs12 { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Configuration for communication with an SMTP service.</summary>
    public class SmtpMsa : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The hostname of the SMTP service. Required.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("host")]
        public virtual string Host { get; set; } 

        /// <summary>The password that will be used for authentication with the SMTP service. This is a write-only field
        /// that can be specified in requests to create or update SendAs settings; it is never populated in
        /// responses.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("password")]
        public virtual string Password { get; set; } 

        /// <summary>The port of the SMTP service. Required.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("port")]
        public virtual System.Nullable<int> Port { get; set; } 

        /// <summary>The protocol that will be used to secure communication with the SMTP service. Required.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("securityMode")]
        public virtual string SecurityMode { get; set; } 

        /// <summary>The username that will be used for authentication with the SMTP service. This is a write-only field
        /// that can be specified in requests to create or update SendAs settings; it is never populated in
        /// responses.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("username")]
        public virtual string Username { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>A collection of messages representing a conversation.</summary>
    public class Thread : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>The ID of the last history record that modified this thread.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("historyId")]
        public virtual System.Nullable<ulong> HistoryId { get; set; } 

        /// <summary>The unique ID of the thread.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("id")]
        public virtual string Id { get; set; } 

        /// <summary>The list of messages in the thread.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("messages")]
        public virtual System.Collections.Generic.IList<Message> Messages { get; set; } 

        /// <summary>A short part of the message text.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("snippet")]
        public virtual string Snippet { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Vacation auto-reply settings for an account. These settings correspond to the "Vacation responder"
    /// feature in the web interface.</summary>
    public class VacationSettings : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Flag that controls whether Gmail automatically replies to messages.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("enableAutoReply")]
        public virtual System.Nullable<bool> EnableAutoReply { get; set; } 

        /// <summary>An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will
        /// automatically reply only to messages that it receives before the end time. If both startTime and endTime are
        /// specified, startTime must precede endTime.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("endTime")]
        public virtual System.Nullable<long> EndTime { get; set; } 

        /// <summary>Response body in HTML format. Gmail will sanitize the HTML before storing it.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("responseBodyHtml")]
        public virtual string ResponseBodyHtml { get; set; } 

        /// <summary>Response body in plain text format.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("responseBodyPlainText")]
        public virtual string ResponseBodyPlainText { get; set; } 

        /// <summary>Optional text to prepend to the subject line in vacation responses. In order to enable auto-
        /// replies, either the response subject or the response body must be nonempty.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("responseSubject")]
        public virtual string ResponseSubject { get; set; } 

        /// <summary>Flag that determines whether responses are sent to recipients who are not in the user's list of
        /// contacts.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("restrictToContacts")]
        public virtual System.Nullable<bool> RestrictToContacts { get; set; } 

        /// <summary>Flag that determines whether responses are sent to recipients who are outside of the user's domain.
        /// This feature is only available for G Suite users.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("restrictToDomain")]
        public virtual System.Nullable<bool> RestrictToDomain { get; set; } 

        /// <summary>An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will
        /// automatically reply only to messages that it receives after the start time. If both startTime and endTime
        /// are specified, startTime must precede endTime.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("startTime")]
        public virtual System.Nullable<long> StartTime { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Set up or update a new push notification watch on this user's mailbox.</summary>
    public class WatchRequest : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>Filtering behavior of labelIds list specified.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelFilterAction")]
        public virtual string LabelFilterAction { get; set; } 

        /// <summary>List of label_ids to restrict notifications about. By default, if unspecified, all changes are
        /// pushed out. If specified then dictates which labels are required for a push notification to be
        /// generated.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("labelIds")]
        public virtual System.Collections.Generic.IList<string> LabelIds { get; set; } 

        /// <summary>A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name
        /// **must** already exist in Cloud Pub/Sub and you **must** have already granted gmail "publish" permission on
        /// it. For example, "projects/my-project-identifier/topics/my-topic-name" (using the Cloud Pub/Sub "v1" topic
        /// naming format).
        ///
        /// Note that the "my-project-identifier" portion must exactly match your Google developer project id (the one
        /// executing this watch request).</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("topicName")]
        public virtual string TopicName { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }    

    /// <summary>Push notification watch response.</summary>
    public class WatchResponse : Google.Apis.Requests.IDirectResponseSchema
    {
        /// <summary>When Gmail will stop sending notifications for mailbox updates (epoch millis). Call watch again
        /// before this time to renew the watch.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("expiration")]
        public virtual System.Nullable<long> Expiration { get; set; } 

        /// <summary>The ID of the mailbox's current history record.</summary>
        [Newtonsoft.Json.JsonPropertyAttribute("historyId")]
        public virtual System.Nullable<ulong> HistoryId { get; set; } 

        /// <summary>The ETag of the item.</summary>
        public virtual string ETag { get; set; }
    }
}
